-
-
Notifications
You must be signed in to change notification settings - Fork 147
[fix] Update templates/supervisor/daphne.j2 command #521
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
base: master
Are you sure you want to change the base?
Conversation
Daphne should not touch the unix socket managed by supervisor, as supervisor will forward the traffic to `--fd 0`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ammubhave are you sure this fixes the issue?
I deployed this with daphne 4.2.0
(env) $ cat /etc/supervisor/conf.d/daphne.conf
[fcgi-program:daphne]
user=www-data
socket=unix:///opt/openwisp2/daphne0.sock
directory=/opt/openwisp2
command=/opt/openwisp2/env/bin/daphne --fd 0 --access-log - --websocket_timeout 3600 --proxy-headers openwisp2.asgi:application
process_name=asgi%(process_num)d
numprocs=1
autostart=true
autorestart=true
stopsignal=INT
redirect_stderr=true
stdout_logfile=/opt/openwisp2/log/daphne.log
stdout_logfile_maxbytes=30MB
stdout_logfile_backups=5
(env) $ pip freeze | grep daphne
daphne==4.2.0
(env) $ tail -f log/daphne.log
nameOrPlugin, args, kw = _parseServer(description, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/openwisp2/env/lib/python3.11/site-packages/twisted/internet/endpoints.py", line 1764, in _parseServer
plugin = _matchPluginToPrefix(
^^^^^^^^^^^^^^^^^^^^^
File "/opt/openwisp2/env/lib/python3.11/site-packages/twisted/internet/endpoints.py", line 1779, in _matchPluginToPrefix
raise ValueError(f"Unknown endpoint type: '{endpointType}'")
ValueError: Unknown endpoint type: 'fd'
/usr/lib/python3/dist-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (2.4.0) or chardet (5.1.0)/charset_normalizer (3.0.1) doesn't match a supported version!
warnings.warn(
/opt/openwisp2/env/lib/python3.11/site-packages/openwisp_utils/admin_theme/system_info.py:4: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources
/opt/openwisp2/env/lib/python3.11/site-packages/dj_rest_auth/registration/serializers.py:228: UserWarning: app_settings.USERNAME_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['username']['required']
required=allauth_account_settings.USERNAME_REQUIRED,
/opt/openwisp2/env/lib/python3.11/site-packages/dj_rest_auth/registration/serializers.py:230: UserWarning: app_settings.EMAIL_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['email']['required']
email = serializers.EmailField(required=allauth_account_settings.EMAIL_REQUIRED)
/opt/openwisp2/env/lib/python3.11/site-packages/dj_rest_auth/registration/serializers.py:288: UserWarning: app_settings.EMAIL_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['email']['required']
email = serializers.EmailField(required=allauth_account_settings.EMAIL_REQUIRED)
Traceback (most recent call last):
File "/opt/openwisp2/env/bin/daphne", line 8, in <module>
sys.exit(CommandLineInterface.entrypoint())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/openwisp2/env/lib/python3.11/site-packages/daphne/cli.py", line 171, in entrypoint
cls().run(sys.argv[1:])
File "/opt/openwisp2/env/lib/python3.11/site-packages/daphne/cli.py", line 291, in run
self.server.run()
File "/opt/openwisp2/env/lib/python3.11/site-packages/daphne/server.py", line 130, in run
ep = serverFromString(reactor, str(socket_description))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/openwisp2/env/lib/python3.11/site-packages/twisted/internet/endpoints.py", line 1844, in serverFromString
nameOrPlugin, args, kw = _parseServer(description, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/openwisp2/env/lib/python3.11/site-packages/twisted/internet/endpoints.py", line 1764, in _parseServer
plugin = _matchPluginToPrefix(
^^^^^^^^^^^^^^^^^^^^^
File "/opt/openwisp2/env/lib/python3.11/site-packages/twisted/internet/endpoints.py", line 1779, in _matchPluginToPrefix
raise ValueError(f"Unknown endpoint type: '{endpointType}'")
ValueError: Unknown endpoint type: 'fd'
/usr/lib/python3/dist-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (2.4.0) or chardet (5.1.0)/charset_normalizer (3.0.1) doesn't match a supported version!
warnings.warn(
I still see the same error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in staging we have:
command=/opt/openwisp2/env/bin/daphne --fd 0 -u /opt/openwisp2/daphne%(process_num)d.sock --access-log - --websocket_timeout 3600 --proxy-headers openwisp2.asgi:application
If I restart the daphne process I don't see the error:
tail log/daphne.log -n 200
/usr/lib/python3/dist-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (2.4.0) or chardet (5.1.0)/charset_normalizer (3.0.1) doesn't match a supported version!
warnings.warn(
/opt/openwisp2/env/lib/python3.11/site-packages/openwisp_utils/admin_theme/system_info.py:4: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources
/opt/openwisp2/env/lib/python3.11/site-packages/dj_rest_auth/registration/serializers.py:228: UserWarning: app_settings.USERNAME_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['username']['required']
required=allauth_account_settings.USERNAME_REQUIRED,
/opt/openwisp2/env/lib/python3.11/site-packages/dj_rest_auth/registration/serializers.py:230: UserWarning: app_settings.EMAIL_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['email']['required']
email = serializers.EmailField(required=allauth_account_settings.EMAIL_REQUIRED)
/opt/openwisp2/env/lib/python3.11/site-packages/dj_rest_auth/registration/serializers.py:288: UserWarning: app_settings.EMAIL_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['email']['required']
email = serializers.EmailField(required=allauth_account_settings.EMAIL_REQUIRED)
/usr/lib/python3/dist-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (2.4.0) or chardet (5.1.0)/charset_normalizer (3.0.1) doesn't match a supported version!
warnings.warn(
I restarted with:
supervisorctl restart daphne:asgi0
Is there another way to trigger the error?
This errors reminds me of : django/daphne#557, it might be worth it to force |
However for the error between supervisor and daphne, I haven't found any other way to reproduce it. Also note it is only in the output of the |
FYI, I just did a redeployment via the current master branch of ansible-openwisp2, and I can reproduce the issue.
Interestingly, my playbook passed successfully, but:
=> to reproduce the failure with theplaybook, that handler needs to be notified somehow. |
Marking as draft because #520 (comment) |
Daphne should not touch the unix socket managed by supervisor, as supervisor will forward the traffic to
--fd 0
Checklist
Reference to Existing Issue
Closes #520.
Description of Changes
The unix socket is managed by
supervisor
for this service, and the traffic is forwarded tofd 0
of the child processes launched.Therefore
daphne
should not know about the unix socket, or it might disturbsupervisor
handling of it.Ref: https://supervisord.org/configuration.html#fcgi-program-x-section-settings