I have a webApp i've been working on and I noticed that every once in a while I will see an error of "Exception in thread CP Server Thread-*" where * = random thread number.This error will occur occasionally and eventually will lock up the web server, preventing it from responding to requests.
I was able to reproduce the same issue with a default "hello World" webPy application using CherryPy to support the SSL.
import web
from web.wsgiserver import CherryPyWSGIServer
# GLOBALS
CherryPyWSGIServer.ssl_certificate = "/.ssl/fpi.crt"
CherryPyWSGIServer.ssl_private_key = "/.ssl/server.key"
urls = (
'/(.*)', 'Hello',
)
app = web.application(urls, globals())
class Hello:
def GET(self, name):
return 'Hello World'
if __name__ == "__main__":
app.run()
The Error is:
73.220.196.76:63982 - - [27/Nov/2018 06:56:50] "HTTP/1.1 GET /" - 200 OK
73.220.196.76:63982 - - [27/Nov/2018 06:56:50] "HTTP/1.1 GET /favicon.ico" - 200 OK
Exception in thread CP Server Thread-9:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/home/brian_barnes/.local/lib/python2.7/site-packages/web/wsgiserver/__init__.py", line 1375, in run
conn.communicate()
File "/home/brian_barnes/.local/lib/python2.7/site-packages/web/wsgiserver/__init__.py", line 1269, in communicate
format_exc())
File "/home/brian_barnes/.local/lib/python2.7/site-packages/web/wsgiserver/__init__.py", line 811, in simple_response
self.conn.wfile.sendall("".join(buf))
File "/home/brian_barnes/.local/lib/python2.7/site-packages/web/wsgiserver/ssl_pyopenssl.py", line 111, in sendall
*args, **kwargs)
File "/home/brian_barnes/.local/lib/python2.7/site-packages/web/wsgiserver/ssl_pyopenssl.py", line 61, in _safe_call
return call(*args, **kwargs)
File "/home/brian_barnes/.local/lib/python2.7/site-packages/web/wsgiserver/__init__.py", line 913, in sendall
bytes_sent = self.send(data)
File "/home/brian_barnes/.local/lib/python2.7/site-packages/web/wsgiserver/ssl_pyopenssl.py", line 115, in send
*args, **kwargs)
File "/home/brian_barnes/.local/lib/python2.7/site-packages/web/wsgiserver/ssl_pyopenssl.py", line 77, in _safe_call
raise socket.error(errnum)
error: -1
Environment: Ubuntu 18.04.1 LTS Python 2.7.15rc1 web.py: 0.39
Has anyone seen an issue like this or know what could be causing it. When reading on webpy.org. It appears this was an issue with version 0.36, but should be good with 0.37. I've thought about going to 0.40 but hesitant as it is still in dev.
errnum
? That won't be -1. Try catching exception socket.error to look at the details (See documentation on socket.error).import cherrypy