-
Notifications
You must be signed in to change notification settings - Fork 245
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
BUG: Port cannot be reused even when the process that opened it has been terminated. #337
Comments
So, this seems to be related to #325 - and is resolved by setting the A couple of points here:
|
I spoke too soon. |
Ruling out other things, I am using Gunicorn, not uWSGI, so the lazy-apps behaviour setting for uWSGI is default behaviour for Gunicorn. |
Ok, I managed to sort this out by switching to Gunicorn/Gevent instead of Gunicorn/Gthread and dropping to one worker per container, as well as defining the I also need to leverage the I am having one problem with this though. Using docker, once a port has been opened it does not seem to be able to be reused until the host is rebooted. After a container has used it; stopping, restarting, deleting that container does not free the port. The port is not in use, but rather this seems to be related to the same file descriptor being reused over and over as the python HTTP client that Unfortunately this is making it nigh impossible to nail down this Django module and ensure production readiness. |
This behaviour seems to be related to https://peps.python.org/pep-0446/#non-inheritable-file-descriptors |
I've been fighting a problem with my graphs from this module because of strange decimal values for number of inserts/deletes/updates of models. After digging into it more, it was observed that the counters for these metrics will randomly 0, and then come back to their original values. There are no restarts of the application. Simply refreshing the
/metrics/
endpoint, if 2 users were created since the last restart of the app, the count will be 2 - then suddenly 0 for up to a minute, then back to 2 again.This results in highly unreliable metrics. I'm uncertain where the problem could lie.
In my models, I am using the
ExportModelOperationsMixin
in all my models as per the docs:Example:
And I am using the
django_prometheus.db.backends.postgresql
engine.Versions:
django_prometheus: 2.2
Django: 4.0.8
Python: 3.9
=========
Update
The remaining problem with this implementation is outlined in #337 (comment) - Once a port has been opened, it cannot be reused until the host is rebooted, even after the container running it has been killed and reaped.
The text was updated successfully, but these errors were encountered: