python-zeep icon indicating copy to clipboard operation
python-zeep copied to clipboard

Zombie timeout closing client connection

Open seanmuth opened this issue 5 years ago • 1 comments
trafficstars

Been using zeep in production for a few months now, and it's going very well, communicating with two different SOAP APIs in the company. We've had an odd issue with one in particular where zeep will hang waiting for a response after a request (upwards of 20 hours) and on the server-side (apache tomcat) the logs show [ERROR] CommonsHTTPTransportSender - null and support for that Server/product are convinced it's a client side timeout issue.

The timeout happens at 5 mins, and I have the client setup like:

        session = Session()
        if self.test:
            pass
        if not self.test:
            session.cert = (os.path.join(BASE_PATH, '21c-prod.crt'),
                            os.path.join(BASE_PATH, '21c-prod-decrypted.key'))

        transport = Transport(cache=SqliteCache(),
                              session=session,
                              timeout=10,
                              operation_timeout=None)
        history = HistoryPlugin()
        client = Client(wsdl=self._get_wsdl_url(),
                        transport=transport,
                        plugins=[history])
        client.settings(strict=strict)

With this setup the request response will hang indefinitely if the response is not received within 5 mins. I've set the timeout to 10m, and zeep will timeout as expected, but during the 5m-10m window, the server may try sending a response which it is unable to send.

I know requests doesn't sent a default timeout And neither does urllib3 So I'm not sure where else to turn

seanmuth avatar Aug 26 '20 20:08 seanmuth

Had been running successfully with zeep in production for months with no issues, but then encountered a similar issue to OP when upstream systems started very rarely to fail to respond to API calls. Setting the operation_timeout parameter to a sensible value as opposed to None resulted in an appropriate timeout exception triggering retry logic.

fifofonix avatar Jul 23 '21 12:07 fifofonix