Closed alexdukemiller closed 7 years ago
First guess is that this actually isn't a zeep issue but a requests / server config issue.
Couple of questions:
Hello,
_1. The requests version I have been using is 2.14.2
-Alex
Reading the traceback it seems that requests expects that the connection is still open but it finds out that the remote server closed the connection.
This seems to be an issue outside of zeep, so I'm afraid I can't really offer any help here. You could try to pass a custom request session to zeep and set it to not use keep-alive? See http://docs.python-zeep.org/en/master/transport.html#transports and the requests documentation
Thank you Michael, I will definitely check out these resources. I appreciate you taking the time to look at the issue for me.
-Alex
Hello,
We are using a Python program as an Inmarsat multi-client server to handle inbound and outbound data.
Our issue is that while the code works initially, it consistently fails after a similar number of iterations for querying inbound messages (between 385 to 440 times) -- we've tried polling periods ranging from 10 sec to 2 minutes with the same results. We have also tried to run the code with zeep versions 1.5.0, 1.6.0, and 2.0.0 with the same results.
We have a simple test case which reliably reproduces the problem. This test case periodically queries the web service for inbound messages, and on the 441st iteration, the OS detects and raises a ConnectionResetError. Before the error is raised the querying thread appears to block for ~2.5 minutes on an invocation of GetReturnMessages(). The Skywave support team has assured us they are seeing nothing abnormal in our interaction with the web service. We therefore suspect that we are using the zeep interface incorrectly and wonder if you could provide some advice.
Also, through experimentation we discovered that resetting the zeep client before the error is detected allows the server to run continuously. So, presently, our code periodically (every 100 iterations) deletes the instance of zeep client we are using and creates a new one. In the attached test case, you can produce the error by setting RESET_COUNT to 10000. Unfortunately, it takes about 1.25 hours to produce the error because we cannot query the web service more frequently than once every 10 seconds.
We really appreciate any assistance you can provide for isolating the source of this problem.
Info:
`
Configurable constants
INBOUND_RX_PERIOD = 10 # Period, in seconds, at which the modem gateway is polled for inbound messages (>10 sec) STATISTICS_PERIOD = 30 # Period, in seconds, at which statistics are printed RESET_COUNT = 100 # Number of iterations between resets of the zeep client
import socket import threading import time import zeep
class ZeepClient:
class InboundMessages(threading.Thread): def init(self): threading.Thread.init(self) self.name = "InboundMessages"
def timestamp(): ts = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(time.time())) print("Current UTC time: {}".format(ts))
Create threads for the server.
inbound_thread = InboundMessages()
Create zeep client to connect with the Skywave gateway
zeep_client = ZeepClient()
Start all the threads.
inbound_thread.start()
Wait until someone kills the server
while True: time.sleep(STATISTICS_PERIOD) print("Main thread is alive.") timestamp()`
Here is the error messages we get in the terminal window upon failure when RESET_COUNT is 10000 on the 441st iteration of the code provided above: