-
Notifications
You must be signed in to change notification settings - Fork 255
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
'WebRequest' object has no attribute 'client_addr' #402
Comments
Hi @marcinocto — Yes... interesting. Happy to take a fix here.
It would be good to pin that down. 🤔 |
Our backend app is used by mobile clients and because it happens on |
Happy to submit a PR if such "fix" would be acceptable |
@marcinocto — Yes, it seems reasonable.
|
Hi, I've recently migrated my Django project from WSGI + gunicorn to ASGI + daphne. It's working great apart from an occasional error in my Sentry/logs
builtins.AttributeError: 'WebRequest' object has no attribute 'client_addr'
.It just seems to be the problem in the
log.debug
call onconnectionLost
in https://github.com/django/daphne/blob/main/daphne/http_protocol.py#L213Looking at the class it seems that there is a chance that the
client_addr
is not set until later in theprocess
method https://github.com/django/daphne/blob/main/daphne/http_protocol.py#L81 so there's a chance that theself.client_addr
is simply not set.I can't replicate this error by any means, it happens only occasionally (I guess that's why it pops up in the
connectionLost
method). Should theclient_addr
be set to None by default so that this log message doesn't cause fatals?BTW I've seen #304 and #244. First one is giving 404 on SO, second one seems similar but they're mentioning websockets whereas I haven't even got to the point where I'm supporting websockets in my app.
Your OS and runtime environment, and browser if applicable
Presumably platform browser agnostic. I don't have a reproduction method.
A
pip freeze
output showing your package versionschannels==3.0.3
channels_redis==3.3.0
daphne==3.0.2
Django==3.2.6
daphne on Heroku with
daphne my_app.asgi:application --port $PORT --bind 0.0.0.0 --verbosity 2
in ProcfileThe text was updated successfully, but these errors were encountered: