Repository navigation
Closed
Description
Checklist
-
I have included the output of
celery -A proj reportin the issue.software -> celery:4.2.1 (windowlicker) kombu:4.2.1 py:3.6.4 billiard:3.5.0.4 redis:2.10.6 platform -> system:Linux arch:64bit imp:CPython loader -> celery.loaders.app.AppLoader settings -> transport:redis results:redis://10.60.242.49:6379/12 BROKER_URL: 'redis://10.60.242.49:6379/11' CELERY_RESULT_BACKEND: 'redis://10.60.242.49:6379/12' CELERY_TIMEZONE: 'Asia/Shanghai' CELERYD_CONCURRENCY: 5 -
I have verified that the issue exists against the
masterbranch of Celery.
Steps to reproduce
Code is as below:
from random import random
from celery import Celery
app = Celery('MigrateCeph')
settings = dict(
BROKER_URL='redis://10.60.242.49:6379/11',
CELERY_RESULT_BACKEND='redis://10.60.242.49:6379/12',
CELERY_TIMEZONE='Asia/Shanghai',
CELERYD_CONCURRENCY=5,
app.config_from_object(settings)
rand_val = random()
@app.task
def add(x, y):
print(f'[Test]: ====> id={id(rand_val)}, val={rand_val}.')
return x + y
Expected behavior
Get 5 different 'random' value.
Actual behavior
I got 5 same 'random' value, and their ID is same too:
[2018-09-01 16:00:14,174: WARNING/ForkPoolWorker-3] [Test]: ====> id=139629697025152, val=0.45579480912770987.
[2018-09-01 16:00:14,174: WARNING/ForkPoolWorker-4] [Test]: ====> id=139629697025152, val=0.45579480912770987.
[2018-09-01 16:00:14,180: WARNING/ForkPoolWorker-2] [Test]: ====> id=139629697025152, val=0.45579480912770987.
[2018-09-01 16:00:14,180: WARNING/ForkPoolWorker-5] [Test]: ====> id=139629697025152, val=0.45579480912770987.
[2018-09-01 16:00:14,184: WARNING/ForkPoolWorker-3] [Test]: ====> id=139629697025152, val=0.45579480912770987.
My Endeavor
In multiprocessing, there are 3 start_method: spawn/fork/forkserver. Each one have its own feature.
Such as, I want every worker have seperated file descriptors and handles. So I can only use spawn or forkserver method, rather than fork.
However, celery only have fork method.
And I have try to use mp.set_start_method() to set it manually.
Unfortunately, it failed too.
Then I found celery use billiard rather than mp. So I tried billiard again, also fail.
Thx for your attention!
Metadata
Metadata
Assignees
Labels
No labels
Activity