pypiserver / pypiserver

Minimal PyPI server for uploading & downloading packages with pip/easy_install

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

watchdog doesn’t trigger events when pypiserver is run with gunicorn

warrenalphonso opened this issue · comments

Minimal reproducible example:

$ docker run --rm -it --entrypoint bash --name pypiserver -p 80:8080 pypiserver/pypiserver:v1.5.0

bash-5.0# gunicorn -w4 'pypiserver:app(roots=["/data/packages"], authenticate=[], password_file=".")'

Loading the simple directory, then uploading a file, and reloading the simple directory will still sometimes show an empty index, depending on which gunicorn worker serves the response.

Debugging further showed that the watchdog event was never being fired. When I tried using the watchdog logic in cache.py separately with the same watchdog version, the event correctly fired when the directory was modified. Not sure where the problem could be.

Using v1.4.2 works with gunicoirn. Using v1.5.0 without gunicorn also works.

i have the same issue, temporary workaround for us is to disable the caching for now: --backend simple-dir

Some more background information:

we also had some issues with "/data/packages" being set as VOLUME in the dockerfile, but we mounted it via kubernetes.
Ended up with using a different path:
args: ["run", "-P", "/data/htpasswd.txt", "-a", "update,download,list", "--server", "gunicorn", "--backend", "simple-dir", "packages2"]

Maybe there is a connection..

Hello @warrenalphonso and @felix1m, thanks for reporting this and providing good examples! Unfortunately, I didn't have the chance to look closer into this yet, but I will try to check this out with higher priority soon. From a quick glance, maybe #454 can be remotely related to solving this problem, but I will take a look twice. Also, #455 seems possibly related.