我正在运行 CherryPy 本地服务器。但一段时间后服务器超时。我是 CherryPy 服务器的新手,我在 error.log 中发现了此消息,但无法解决此问题。
CherryPy==18.8.0
Cherrot==8.6.0
Python==3.8.1
Traceback (most recent call last):
File "C:\Users\test\Envs\eps\lib\site-packages\cheroot\server.py", line 1300, in communicate
req.respond()
File "C:\Users\test\Envs\eps\lib\site-packages\cheroot\server.py", line 1090, in respond
self.server.gateway(self).respond()
File "C:\Users\test\Envs\eps\lib\site-packages\cheroot\wsgi.py", line 145, in respond
self.write(chunk)
File "C:\Users\test\Envs\eps\lib\site-packages\cheroot\wsgi.py", line 231, in write
self.req.write(chunk)
File "C:\Users\test\Envs\eps\lib\site-packages\cheroot\server.py", line 1146, in write
self.conn.wfile.write(chunk)
File "C:\Users\test\Envs\eps\lib\site-packages\cheroot\makefile.py", line 438, in write
res = super().write(val, *args, **kwargs)
File "C:\Users\test\Envs\eps\lib\site-packages\cheroot\makefile.py", line 36, in write
self._flush_unlocked()
File "C:\Users\test\Envs\eps\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
n = self.raw.write(bytes(self._write_buf))
File "c:\python381\lib\socket.py", line 687, in write
return self._sock.send(b)
File "c:\python381\lib\ssl.py", line 1173, in send
return self._sslobj.write(data)
socket.timeout: The write operation timed out
您可能只需要增加启动时提供给 Cherrypy 的配置文件中的
server.socket_timeout
值。默认值为 10(秒)。将其增加到适合我的应用程序可能产生的大量响应的值,这对我来说很有效。
我最近遇到了这个问题,通过搜索错误消息找不到这个简单的解决方案。希望下一个遇到这个问题的人会看到这一点。