jrabbit / pyborg-1up

:robot: A modern overhaul of an old favorite irc bot for multiple platforms
https://pyborg.readthedocs.io/en/latest/
GNU General Public License v3.0
33 stars 12 forks source link

Weird stack problem in wsgiref server even though saving is actually fast? #86

Open jrabbit opened 5 years ago

jrabbit commented 5 years ago

I think that's whats causing this exception

Mar 08 07:07:04 trotsky pyborg_http[14956]: 127.0.0.1 - - [08/Mar/2019 06:37:46] "POST /save HTTP/1.1" 500 59
Mar 08 07:07:04 trotsky pyborg_http[14956]: ----------------------------------------
Mar 08 07:07:04 trotsky pyborg_http[14956]: Exception happened during processing of request from ('127.0.0.1', 36972)
Mar 08 07:07:04 trotsky pyborg_http[14956]: Traceback (most recent call last):
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 138, in run
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.finish_response()
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 180, in finish_response
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.write(data)
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 274, in write
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.send_headers()
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 332, in send_headers
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.send_preamble()
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 255, in send_preamble
Mar 08 07:07:04 trotsky pyborg_http[14956]:     ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 453, in _write
Mar 08 07:07:04 trotsky pyborg_http[14956]:     result = self.stdout.write(data)
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/socketserver.py", line 803, in write
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self._sock.sendall(b)
Mar 08 07:07:04 trotsky pyborg_http[14956]: BrokenPipeError: [Errno 32] Broken pipe
Mar 08 07:07:04 trotsky pyborg_http[14956]: During handling of the above exception, another exception occurred:
Mar 08 07:07:04 trotsky pyborg_http[14956]: Traceback (most recent call last):
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 141, in run
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.handle_error()
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 368, in handle_error
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.finish_response()
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 180, in finish_response
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.write(data)
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 274, in write
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.send_headers()
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 331, in send_headers
Mar 08 07:07:04 trotsky pyborg_http[14956]:     if not self.origin_server or self.client_is_modern():
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 344, in client_is_modern
Mar 08 07:07:04 trotsky pyborg_http[14956]:     return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
Mar 08 07:07:04 trotsky pyborg_http[14956]: TypeError: 'NoneType' object is not subscriptable
Mar 08 07:07:04 trotsky pyborg_http[14956]: During handling of the above exception, another exception occurred:
Mar 08 07:07:04 trotsky pyborg_http[14956]: Traceback (most recent call last):
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/socketserver.py", line 320, in _handle_request_noblock
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.process_request(request, client_address)
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/socketserver.py", line 351, in process_request
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.finish_request(request, client_address)
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/socketserver.py", line 364, in finish_request
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.RequestHandlerClass(request, client_address, self)
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/socketserver.py", line 724, in __init__
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.handle()
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/simple_server.py", line 133, in handle
Mar 08 07:07:04 trotsky pyborg_http[14956]:     handler.run(self.server.get_app())
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/handlers.py", line 144, in run
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.close()
Mar 08 07:07:04 trotsky pyborg_http[14956]:   File "/home/jack/.pyenv/versions/3.6.8/lib/python3.6/wsgiref/simple_server.py", line 35, in close
Mar 08 07:07:04 trotsky pyborg_http[14956]:     self.status.split(' ',1)[0], self.bytes_sent
Mar 08 07:07:04 trotsky pyborg_http[14956]: AttributeError: 'NoneType' object has no attribute 'split'
jrabbit commented 4 years ago

fix is to use real wsgi server package

jrabbit commented 4 years ago

Running on not 3.6 seems to fix this as well.