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

Cannot run ddtrace-run celery worker attempts to execute celery with python #493

Closed
jcummins54 opened this issue Jun 19, 2018 · 12 comments
Closed

Comments

@jcummins54
Copy link

jcummins54 commented Jun 19, 2018

ddtrace-run celery runs the celery application, but if anything is added after "celery" ddtrace-run attempts to run it with python:

$ ddtrace-run celery worker --queues default --loglevel=INFO --concurrency=4 --maxtasksperchild=100 -n default.%%n

/home/vagrant/venv/bin/python2.7 /home/vagrant/venv/bin/celery worker --queues default --loglevel=INFO --concurrency=4 --maxtasksperchild=100 -n default.%%n: can't open file '/home/vagrant/venv/bin/celery worker --queues default --loglevel=INFO --concurrency=4 --maxtasksperchild=100 -n default.%%n': [Errno 2] No such file or directory

Update: This is only an issue with ddtrace 0.12.1, verified that ddtrace 0.12.0 runs celery. However, we aren't seeing APM metrics in the dashboard either way.

@palazzem palazzem added this to the 0.12.2 milestone Jun 25, 2018
@palazzem
Copy link

Hello @jcummins54 and thanks for the feedback! I'm checking this issue with the ddtrace-run script that requires more work in this 0.12.x release. Once I've reproduced the problem, I'll provide you a PR to test so that we're sure the script properly wraps any kind of binary.

@mgu
Copy link
Contributor

mgu commented Jun 26, 2018

Same error for me when lauching gunicorn.
If I revert https://github.com/DataDog/dd-trace-py/pull/469/files the error disappears.

Looks like sys.argv is not filled for a good reason https://bugs.python.org/issue2972

@mgu
Copy link
Contributor

mgu commented Jun 26, 2018

After some tests, the error with gunicorn appears with ddtrace 0.12.1 AND setproctitle installed.
If I uninstall setproctitle then I can launch gunicorn without error

@palazzem
Copy link

Thanks @mgu for the investigation! We're preparing an alternative to make it work when celery is imported while sys.argv is not filled. We'll try to fix the problem with ddtrace-run as soon as possible.

Thank you!

@palazzem
Copy link

Sorry for the delay, but we're checking if the new way we're instrumenting Celery address properly this issue, so that the included patch can be reverted to avoid issues (as explained in https://bugs.python.org/issue2972). This is the last part we're missing, but we'll be sure to find the solution quickly and ship the new release next week.

@mgu
Copy link
Contributor

mgu commented Jul 27, 2018

I can test your fix before the release if it can help

@Kyle-Verhoog
Copy link
Member

Hi @jcummins54, @mgu

I've been looking into this issue, can you provide some more detail about your setups? A regression test or sample app would be of great help!

@mgu
Copy link
Contributor

mgu commented Aug 6, 2018

I will try to setup a test or a small app in order to reproduce this issue, I'll keep you updated

@mgu
Copy link
Contributor

mgu commented Aug 8, 2018

Harder to reproduce than expected (on a dedicated app), I'll try something else tomorrow :)

@Kyle-Verhoog
Copy link
Member

Hey @mgu thanks so much for the effort! Haha, I had absolutely no success replicating it either.

Don't worry about trying to replicate further. We've changed our patching mechanism for celery with #534. It is also based off of #530 which should include our improved celery integration.

If you could try using the kyle-verhoog/celery-hook branch and report back if you have any problems that'd be awesome!

Thanks 😄

@mgu
Copy link
Contributor

mgu commented Aug 9, 2018

Tested (with a fix to avoid undefined patched variable in monkey.py) :

  • [Errno 2] No such file or directory is gone
  • it seems to work without patch(celery=True)

Thanks a lot ! 😁

@palazzem
Copy link

palazzem commented Aug 9, 2018

Great @mgu ! ok we'll connect all the dots to prepare our release. We had also other positive feedbacks so we can proceed. I'll keep the thread updated.

Thank you very much, especially for your patience!

@palazzem palazzem modified the milestones: 0.12.2, 0.13.0 Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants