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

pyuwsgi with plugins: undefined symbol uwsgi #16

Open
asottile-sentry opened this issue Aug 16, 2022 · 1 comment · May be fixed by #17
Open

pyuwsgi with plugins: undefined symbol uwsgi #16

asottile-sentry opened this issue Aug 16, 2022 · 1 comment · May be fixed by #17

Comments

@asottile-sentry
Copy link

a small reproduction

#!/usr/bin/env bash
set -euxo pipefail

rm -rf uwsgi-dogstatsd
git clone https://github.com/DataDog/uwsgi-dogstatsd
cd uwsgi-dogstatsd/example

virtualenv venv
export PATH="$PWD/venv/bin:$PATH"

pip install "${1:-pyuwsgi}"
uwsgi --build-plugin ..
uwsgi app.ini
$ bash t.sh 
+ rm -rf uwsgi-dogstatsd
+ git clone https://github.com/DataDog/uwsgi-dogstatsd
Cloning into 'uwsgi-dogstatsd'...
remote: Enumerating objects: 84, done.
remote: Total 84 (delta 0), reused 0 (delta 0), pack-reused 84
Receiving objects: 100% (84/84), 19.95 KiB | 600.00 KiB/s, done.
Resolving deltas: 100% (27/27), done.
+ cd uwsgi-dogstatsd/example
+ virtualenv venv
created virtual environment CPython3.10.4.final.0-64 in 78ms
  creator CPython3Posix(dest=/tmp/y/uwsgi-dogstatsd/example/venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/asottile/.local/share/virtualenv)
    added seed packages: pip==22.2.2, setuptools==63.4.1, wheel==0.37.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
+ export PATH=/tmp/y/uwsgi-dogstatsd/example/venv/bin:/home/asottile/bin:/home/asottile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
+ PATH=/tmp/y/uwsgi-dogstatsd/example/venv/bin:/home/asottile/bin:/home/asottile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
+ pip install pyuwsgi
Collecting pyuwsgi
  Using cached pyuwsgi-2.0.20-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (926 kB)
Installing collected packages: pyuwsgi
Successfully installed pyuwsgi-2.0.20
+ uwsgi --build-plugin ..
*** uWSGI building and linking plugin from .. ***
[aarch64-linux-gnu-gcc] dogstatsd_plugin.so
build time: 0 seconds
*** dogstatsd plugin built and available in dogstatsd_plugin.so ***
+ uwsgi app.ini
[uWSGI] getting INI configuration from app.ini
!!! UNABLE to load uWSGI plugin: ./dogstatsd_plugin.so: undefined symbol: uwsgi !!!
unable to find "dogstatsd" stats_pusher

seems to work fine with uwsgi though:

$ bash t.sh uwsgi
...
Successfully installed uwsgi-2.0.20
+ uwsgi --build-plugin ..
*** uWSGI building and linking plugin from .. ***
[aarch64-linux-gnu-gcc] dogstatsd_plugin.so
build time: 0 seconds
*** dogstatsd plugin built and available in dogstatsd_plugin.so ***
+ uwsgi app.ini
[uWSGI] getting INI configuration from app.ini
*** Starting uWSGI 2.0.20 (64bit) on [Tue Aug 16 11:04:36 2022] ***
compiled with version: 11.2.0 on 16 August 2022 15:04:32
os: Linux-5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:08:11 UTC 2022
nodename: asottile-work-vm
machine: aarch64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /tmp/y/uwsgi-dogstatsd/example
detected binary path: /tmp/y/uwsgi-dogstatsd/example/venv/bin/uwsgi
your processes number limit is 15222
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :9090 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:35949 (port auto-assigned) fd 3
Python version: 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
Python main interpreter initialized at 0xaaaae3ec5310
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145840 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
initialized 38 metrics
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0xaaaae3ec5310 pid: 13901 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 13901)
spawned uWSGI worker 1 (pid: 13902, cores: 1)
metrics collector thread started
spawned uWSGI http 1 (pid: 13905)
^CSIGINT/SIGTERM received...killing workers...
gateway "uWSGI http 1" has been buried (pid: 13905)
worker 1 buried after 1 seconds
goodbye to uWSGI.
@asottile-sentry
Copy link
Author

asottile-sentry commented Aug 16, 2022

ok I've found a maybe terrible workaround?

import os
import sys
orig = sys.getdlopenflags()
sys.setdlopenflags(orig | os.RTLD_GLOBAL)
try:
    import pyuwsgi
finally:
    sys.setdlopenflags(orig)

sys.exit(pyuwsgi.run())

this seems to work!

@asottile-sentry asottile-sentry linked a pull request Aug 16, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant