Repository: pypi/warehouse

Issue:
Docker compose "web" service fails to reload on code changes
Recently I've been noticing the reloading of the web service errors forcing me to restart the docker compose service. Has anyone else experienced this?

Hupper enters a cycle where it can't bind to the port because it is already in use. Here are the logs:

```
web_1            | [2019-09-04 09:31:05 +0000] [16] [INFO] Worker exiting (pid: 16)
web_1            | Server did not exit, forcefully killing.
web_1            | Starting monitor for PID 17.
web_1            | {"logger": "raven.base.Client", "level": "INFO", "event": "Raven is not configured (logging is disabled). Please see the documentation for more information.", "thread": 140079147017984}
web_1            | [2019-09-04 09:31:31 +0000] [17] [INFO] Starting gunicorn 19.9.0
web_1            | [2019-09-04 09:31:31 +0000] [17] [ERROR] Connection in use: ('0.0.0.0', 8000)
web_1            | [2019-09-04 09:31:31 +0000] [17] [ERROR] Retrying in 1 second.
web_1            | [2019-09-04 09:31:32 +0000] [17] [ERROR] Connection in use: ('0.0.0.0', 8000)
web_1            | [2019-09-04 09:31:32 +0000] [17] [ERROR] Retrying in 1 second.
web_1            | [2019-09-04 09:31:33 +0000] [17] [ERROR] Connection in use: ('0.0.0.0', 8000)
web_1            | [2019-09-04 09:31:33 +0000] [17] [ERROR] Retrying in 1 second.
web_1            | [2019-09-04 09:31:34 +0000] [17] [ERROR] Connection in use: ('0.0.0.0', 8000)
web_1            | [2019-09-04 09:31:34 +0000] [17] [ERROR] Retrying in 1 second.
web_1            | [2019-09-04 09:31:35 +0000] [17] [ERROR] Connection in use: ('0.0.0.0', 8000)
web_1            | [2019-09-04 09:31:35 +0000] [17] [ERROR] Retrying in 1 second.
web_1            | [2019-09-04 09:31:36 +0000] [17] [ERROR] Can't connect to ('0.0.0.0', 8000)
web_1            | Press ENTER or change a file to reload.
web_1            | Traceback (most recent call last):
web_1            |   File "<string>", line 1, in <module>
web_1            |   File "/opt/warehouse/lib/python3.7/site-packages/hupper/ipc.py", line 318, in spawn_main
web_1            |     func(**kwargs)
web_1            |   File "/opt/warehouse/lib/python3.7/site-packages/hupper/worker.py", line 263, in worker_main
web_1            |     func(*spec_args, **spec_kwargs)
web_1            |   File "/opt/warehouse/lib/python3.7/site-packages/hupper/reloader.py", line 285, in wait_main
web_1            |     input('')
web_1            | EOFError: EOF when reading a line
web_1            | Starting monitor for PID 30.

... repeats endlessly...
```


Discussion:
I've noticed this too. Thanks for filing an issue about it!
This is happening again but the output is different:

```
web_1            | /opt/warehouse/src/warehouse/search/queries.py changed; reloading ...
web_1            | Gracefully killing the server.
web_1            | [2020-02-26 20:51:14 +0000] [9] [INFO] Handling signal: term
web_1            | [2020-02-26 20:51:14 +0000] [16] [INFO] Worker exiting (pid: 16)
web_1            | Server did not exit, forcefully killing.
web_1            | Starting monitor for PID 17.
web_1            | {"logger": "raven.base.Client", "level": "INFO", "event": "Raven is not configured (logging is disabled). Please see the documentation for more information.", "thread": 139630094440192}
web_1            | [2020-02-26 20:51:32 +0000] [17] [INFO] Starting gunicorn 20.0.4
web_1            | [2020-02-26 20:51:32 +0000] [17] [ERROR] Connection in use: ('0.0.0.0', 8000)                                                                                                                                              web_1            | [2020-02-26 20:51:32 +0000] [17] [ERROR] Retrying in 1 second.
web_1            | [2020-02-26 20:51:33 +0000] [17] [ERROR] Connection in use: ('0.0.0.0', 8000)
web_1            | [2020-02-26 20:51:33 +0000] [17] [ERROR] Retrying in 1 second.
```
I thought https://github.com/pypa/warehouse/pull/7404 might resolve this (the changelog looks promising) but I'm still seeing this as well.
I'm also still experiencing this with versions of hupper that used to work.
@yeraydiazdiaz Looks like hupper made a new release which might solve this: https://github.com/pypa/warehouse/pull/7479
The new hupper release did not seem to solve this. Downgrading to gunicorn 19.x did not resolve it either.

Resolving patch:
diff --git a/gunicorn.conf.py b/gunicorn-prod.conf.py
similarity index 100%
rename from gunicorn.conf.py
rename to gunicorn-prod.conf.py


Test patch: