Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kombu filesystem transport not thread safe #398

Closed
harlowja opened this issue Aug 29, 2014 · 8 comments · Fixed by #1593 or #1596
Closed

Kombu filesystem transport not thread safe #398

harlowja opened this issue Aug 29, 2014 · 8 comments · Fixed by #1593 or #1596

Comments

@harlowja
Copy link
Contributor

From looking it over it appears that this transport isn't thread safe.

I've hit errors like http://paste.openstack.org/show/102226/ a few times and am thinking these class of errors are due to files getting moved by more than one thread. Perhaps some basic locking is in order?

@harlowja
Copy link
Contributor Author

I've been able to see this where the file length that is read (by a consumer) ends up being zero length; quite odd, even if I use the processed_folder and store_processed options. Any idea? It doesn't occur all the time (but I'm guessing this is due to threads being non-determinstic...)

@harlowja
Copy link
Contributor Author

A few more examples with a test program that seems to cause this issue...

http://paste.ubuntu.com/8184078/

https://github.com/harlowja/BrokenTest is the test program (at test.py)

Pretty reliably get that error...

@harlowja
Copy link
Contributor Author

Also the virtualenv that I am using:

Babel==1.3
amqp==1.4.6
anyjson==0.3.3
importlib==1.0.3
iso8601==0.1.10
kombu==3.0.21
ordereddict==1.1
pytz==2014.4
six==1.7.3
wsgiref==0.1.2

@pran1990
Copy link

I ran the BrokenTest Josh posted above too, and saw similar errors.
http://paste.ubuntu.com/8190131/

@ask
Copy link
Contributor

ask commented Sep 4, 2014

It probably isn't thread safe, and that would be low on my priorities to fix

@harlowja
Copy link
Contributor Author

harlowja commented Sep 4, 2014

Understandable that its low priority, but seems at least justified to document that?

@mpenalver
Copy link

Attached the version we use, which also avoids the copy of the msgs to tmp. Credit to https://github.com/benediktschmitt/py-filelock.
filesystem.py.tar.gz

@auvipy auvipy modified the milestones: 5.0, 4.7 Aug 24, 2019
@jhofeditz
Copy link

Thanks! @mpenalver I also have this problem and will try your fix. Can you submit it as a PR?

@auvipy auvipy modified the milestones: 5.1.0, 6.0 Sep 10, 2021
@auvipy auvipy modified the milestones: 6.0, 5.3 Apr 17, 2022
karajan1001 added a commit to karajan1001/kombu that referenced this issue Sep 6, 2022
fix: celery#398
Currently only write lock used in msg/exchange file written. Cause
reading in other thread got some incomplete result.

1. Add timeout for the lock acquire.
2. Add Share locks when reading message from filesystem.
3. Add a unit test for the `lock` and `unlock`
4. Add a unit test to test the lock during message processing.
karajan1001 added a commit to karajan1001/kombu that referenced this issue Sep 6, 2022
fix: celery#398
Currently only write lock used in msg/exchange file written. Cause
reading in other thread got some incomplete result.

1. Add timeout for the lock acquire.
2. Add Share locks when reading message from filesystem.
3. Add a unit test for the `lock` and `unlock`
4. Add a unit test to test the lock during message processing.
auvipy pushed a commit that referenced this issue Sep 7, 2022
* Solve Kombu filesystem transport not thread safe

fix: #398
Currently only write lock used in msg/exchange file written. Cause
reading in other thread got some incomplete result.

1. Add timeout for the lock acquire.
2. Add Share locks when reading message from filesystem.
3. Add a unit test for the `lock` and `unlock`
4. Add a unit test to test the lock during message processing.

* Replace deprecated function.
karajan1001 added a commit to karajan1001/kombu that referenced this issue Sep 12, 2022
partly fix: celery#398
1. add exclusive lock during the whole exchange file update.
2. add some unit test for file lock
karajan1001 added a commit to karajan1001/kombu that referenced this issue Sep 13, 2022
partly fix: celery#398
1. add exclusive lock during the whole exchange file update.
2. add some unit test for file lock
karajan1001 added a commit to karajan1001/kombu that referenced this issue Sep 14, 2022
partly fix: celery#398
1. add exclusive lock during the whole exchange file update.
2. add some unit test for file lock
auvipy pushed a commit that referenced this issue Sep 23, 2022
partly fix: #398
1. add exclusive lock during the whole exchange file update.
2. add some unit test for file lock
karajan1001 added a commit to karajan1001/kombu that referenced this issue Sep 26, 2022
partly fix: celery#398
1. add exclusive lock during the whole exchange file update.
2. add some unit test for file lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment