question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'WebRequest' object has no attribute 'client_addr' under Firefox

See original GitHub issue

While instantiating a WebSocket object under Firefox64, i.e.

new WebSocket(`wss://${window.location.host}/path/to/room`);

… and having Daphne set to the highest level of verbosity, I get the following server-side error:

[07/Jan/2019:17:09:51 +0100] [upstream] [903083] STDERR: 2019-01-07 16:09:51,657 INFO     "127.0.0.1" - - [11/Mar/1970:02:49:09 +0000] "GET / HTTP/1.1" 500 27 "https://bored.alwaysdata.net/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0"
[07/Jan/2019:17:09:51 +0100] [upstream] [903083] STDERR: 2019-01-07 16:09:51,657 DEBUG    HTTP response complete for ['127.0.0.1', 42164]
[07/Jan/2019:17:09:51 +0100] [upstream] [903083] STDERR: 2019-01-07 16:09:51,658 DEBUG    poll 622.967 ms took 0.098 ms: 1 events
[07/Jan/2019:17:09:51 +0100] [upstream] [903083] STDERR: 2019-01-07 16:09:51,658 DEBUG    poll 622.617 ms took 0.050 ms: 1 events
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR: 2019-01-07 16:09:53,819 DEBUG    poll 999.816 ms took 536.038 ms: 1 events
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR: 2019-01-07 16:09:53,819 DEBUG    poll 463.229 ms took 0.011 ms: 1 events
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR: 2019-01-07 16:09:53,820 DEBUG    poll 462.904 ms took 0.008 ms: 1 events
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR: 2019-01-07 16:09:53,821 CRITICAL Unhandled Error
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR: Traceback (most recent call last):
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/home/.virtualenvs/boredenv/lib/python3.7/site-packages/twisted/internet/asyncioreactor.py", line 267, in run
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     self._asyncioEventloop.run_forever()
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/usr/alwaysdata/python/3.7.1/lib/python3.7/asyncio/base_events.py", line 528, in run_forever
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     self._run_once()
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/usr/alwaysdata/python/3.7.1/lib/python3.7/asyncio/base_events.py", line 1756, in _run_once
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     handle._run()
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/usr/alwaysdata/python/3.7.1/lib/python3.7/asyncio/events.py", line 88, in _run
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     self._context.run(self._callback, *self._args)
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR: --- <exception caught here> ---
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/home/.virtualenvs/boredenv/lib/python3.7/site-packages/twisted/python/log.py", line 103, in callWithLogger
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     return callWithContext({"system": lp}, func, *args, **kw)
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/home/.virtualenvs/boredenv/lib/python3.7/site-packages/twisted/python/log.py", line 86, in callWithContext
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     return context.call({ILogContext: newCtx}, func, *args, **kw)
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/home/.virtualenvs/boredenv/lib/python3.7/site-packages/twisted/python/context.py", line 122, in callWithContext
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     return self.currentContext().callWithContext(ctx, func, *args, **kw)
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/home/.virtualenvs/boredenv/lib/python3.7/site-packages/twisted/python/context.py", line 85, in callWithContext
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     return func(*args,**kw)
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/home/.virtualenvs/boredenv/lib/python3.7/site-packages/twisted/internet/asyncioreactor.py", line 141, in _readOrWrite
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     self._disconnectSelectable(selectable, why, read)
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/home/.virtualenvs/boredenv/lib/python3.7/site-packages/twisted/internet/posixbase.py", line 255, in _disconnectSelectable
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     selectable.connectionLost(f)
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/home/.virtualenvs/boredenv/lib/python3.7/site-packages/twisted/internet/tcp.py", line 327, in connectionLost
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     protocol.connectionLost(reason)
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/home/.virtualenvs/boredenv/lib/python3.7/site-packages/twisted/web/http.py", line 2339, in connectionLost
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     request.connectionLost(reason)
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:   File "/home/.virtualenvs/boredenv/lib/python3.7/site-packages/daphne/http_protocol.py", line 202, in connectionLost
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR:     logger.debug("HTTP disconnect for %s", self.client_addr)
[07/Jan/2019:17:09:53 +0100] [upstream] [903083] STDERR: builtins.AttributeError: 'WebRequest' object has no attribute 'client_addr'

With Chrome, the WebSocket-Upgrade is perfectly handled, see

[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,440 INFO     "127.0.0.1" - - [11/Mar/1970:02:52:07 +0000] "GET / HTTP/1.1" 200 2540 "https://bored.alwaysdata.net/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134"
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,440 DEBUG    HTTP response complete for ['127.0.0.1', 59340]
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,440 DEBUG    poll 20.169 ms took 0.019 ms: 1 events
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,441 DEBUG    poll 19.849 ms took 0.052 ms: 1 events
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,535 DEBUG    poll 957.750 ms took 74.050 ms: 1 events
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,536 DEBUG    HTTP b'GET' request for ['127.0.0.1', 59340]
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,580 DEBUG    poll 881.080 ms took 42.220 ms: 1 events
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,581 DEBUG    poll 838.234 ms took 0.014 ms: 1 events
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,586 DEBUG    Upgraded connection ['127.0.0.1', 60946] to WebSocket
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,635 DEBUG    poll 783.904 ms took 0.011 ms: 1 events
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,638 DEBUG    poll 780.953 ms took 0.026 ms: 1 events
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,639 DEBUG    WebSocket ['127.0.0.1', 60946] open and established
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,639 DEBUG    WebSocket ['127.0.0.1', 60946] accepted by application
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,651 DEBUG    poll 779.949 ms took 12.212 ms: 1 events
[07/Jan/2019:17:12:50 +0100] [upstream] [903083] STDERR: 2019-01-07 16:12:50,652 DEBUG    HTTP 200 response started for ['127.0.0.1', 59340]
...

Client-side, all this results in a 400 status code.


My OS is Debian GNU/Linux 8.11 (jessie) and pip freeze returns

aioredis==1.2.0
asgiref==2.3.2
asn1crypto==0.24.0
async-timeout==3.0.1
attrs==18.2.0
autobahn==18.12.1
Automat==0.7.0
certifi==2018.11.29
cffi==1.11.5
channels==2.1.6
channels-redis==2.3.2
chardet==3.0.4
constantly==15.1.0
cryptography==2.4.2
Cython==0.29.2
daphne==2.2.4
defusedxml==0.5.0
Django==2.1.4
django-allauth==0.38.0
django-extensions==1.6.7
h2==3.0.1
hiredis==0.3.1
hpack==3.0.0
hyperframe==5.1.0
hyperlink==18.0.0
idna==2.8
incremental==17.5.0
msgpack==0.5.6
oauthlib==2.1.0
Pillow==5.3.0
priority==1.3.0
psycopg2-binary==2.7.6.1
pyasn1==0.4.5
pyasn1-modules==0.2.3
pycparser==2.19
PyHamcrest==1.9.0
pyOpenSSL==18.0.0
pyproj==1.9.5.1
python-dateutil==2.7.5
python3-openid==3.1.0
pytz==2018.7
redis==3.0.1
requests==2.21.0
requests-oauthlib==1.0.0
service-identity==18.1.0
six==1.12.0
Twisted==18.9.0
txaio==18.8.1
urllib3==1.24.1
whitenoise==4.1.2
zope.interface==4.6.0

But I had the same problem with previous versions, regarding the libraries’ or Python3’s.

ps: Daphne is awesome.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
lfaucheuxcommented, Jan 28, 2019

So… It looks like the problem is not du to Daphne! I’ll be back very soon with a confirmation…

0reactions
lfaucheuxcommented, Jan 28, 2019

@andrewgodwin Ok. This is not du to Daphne!! I use a share hosting Service and the so-implied proxy was doing weird things.

Read more comments on GitHub >

github_iconTop Results From Across the Web

webRequest - MDN Web Docs - Mozilla
Chrome Edge BlockingResponse Full support. ChromeYes. Toggle history Full... BlockingResponse.upgradeToSecure No support. ChromeNo. Toggle history No s... CertificateInfo No support. ChromeNo. footnote. Toggle history No s......
Read more >
Python Selenium 'WebDriver' object has no attribute firefox error
I'm trying to scrape some content from web using selenium from selenium import webdriver from selenium.webdriver.common.keys import Keys ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found