我正在使用 Gunicorn 作为 WSGI 服务器在 Heroku 上运行 Flask 应用程序。最近,我在访问两个特定端点时遇到间歇性的 H18 错误
2023-03-12T09:49:42.253904+00:00 heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=POST path="/prefabs/generate" host=* request_id=#-#-#-#-# dyno=web.1 connect=0ms service=2330ms status=503 bytes= protocol=https
2023-03-12T09:49:42.247724+00:00 app[web.1]: Returning test object
2023-03-12T09:49:42.250248+00:00 app[web.1]: [12/Mar/2023:09:49:42 +0000] "POST /prefabs/generate HTTP/1.1" 200 23240 "http://localhost:4200/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
从上面的两个请求可以看出,应用程序正常处理了所有的结果,但是一将这些信息传递给路由器,路由器就崩溃了
我的应用程序中的所有其他端点都按预期工作。我已经尝试切换到 Waitress 作为 WSGI 服务器,这解决了这个问题,但如果可能的话我更愿意使用 Gunicorn。是什么导致 Gunicorn 仅针对这两个端点出现此错误,我该如何解决?