getsentry / self-hosted

Sentry, feature-complete and packaged up for low-volume deployments and proofs-of-concept
https://develop.sentry.dev/self-hosted/
Other
7.49k stars 1.7k forks source link

uwsgi procname not working #3136

Open doc-sheet opened 2 weeks ago

doc-sheet commented 2 weeks ago

Environment

self-hosted (https://develop.sentry.dev/self-hosted/)

Steps to Reproduce

  1. sentry run web
  2. ps -ef

Expected Result

[Sentry] something in proc titles

Actual Result

/.venv/bin/python3 -c import os import sys orig = sys.getdlopenflags() sys.setdlopenflags(orig | os.RTLD_GLOBAL) try: import pyuwsgi finally: sys.setdlopenflags(orig) pyuwsgi.run()

Product Area

Unknown

Link

No response

DSN

No response

Version

24.5.1

getsantry[bot] commented 2 weeks ago

Assigning to @getsentry/support for routing ⏲️

doc-sheet commented 2 weeks ago

Hi! For some reason procname-related settings does not work in my environment

I use self-hosted configs, application runs in docker, everything is fine except procnames I see

UWSGI_AUTO_PROCNAME=true
UWSGI_PROCNAME_PREFIX_SPACED=[Sentry]

in process environment (which is default from https://github.com/getsentry/sentry/blob/24.5.1/src/sentry/services/http.py#L69)

Could you help me debug this issue? Does it look same in your environment?

azaslavsky commented 1 week ago

Our dogfood instance has both of those set. I am not sure what else would be causing the issue.

/.venv/bin/python3 -c import os import sys orig = sys.getdlopenflags() sys.setdlopenflags(orig | os.RTLD_GLOBAL) try: import pyuwsgi finally: sys.setdlopenflags(orig) pyuwsgi.run()

Is that what you see in your console when you try to run the server? I'm a bit confused about what this line means.

doc-sheet commented 1 week ago

Yeah. I see it in processes list with ps axuww

It is a way how sentry starts uwsgi https://github.com/getsentry/sentry/blob/946fd80aec3ed0b0df8b152013ec5326ce2ff79f/src/sentry/services/http.py#L10

I guess execve not working well or maybe something in my setup (I run containers as non-privileged user) blocks uwsgi from changing proctitle. setproctitle module however works well in such environment.

I haven't tried to run uwsgi directly to check is there is a difference https://github.com/unbit/uwsgi/blob/578dfcab74e976227be44fa94980ab3abe4cbbc5/contrib/runuwsgi.py#L58 from pyuwsgi.run()