104, 'Connection reset by peer' socket error, or When does closing a socket result in a RST rather than FIN?

前端 未结 4 2074
情话喂你
情话喂你 2020-11-29 23:44

We\'re developing a Python web service and a client web site in parallel. When we make an HTTP request from the client to the service, one call consistently raises a socket

4条回答
  •  囚心锁ツ
    2020-11-30 00:35

    I've had this problem. See The Python "Connection Reset By Peer" Problem.

    You have (most likely) run afoul of small timing issues based on the Python Global Interpreter Lock.

    You can (sometimes) correct this with a time.sleep(0.01) placed strategically.

    "Where?" you ask. Beats me. The idea is to provide some better thread concurrency in and around the client requests. Try putting it just before you make the request so that the GIL is reset and the Python interpreter can clear out any pending threads.

提交回复
热议问题