Bugs item #2994205, was opened at 2010-04-30 00:51
Message generated for change (Settings changed) made by mhammond
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=2994205&group_id=78018
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: adamhj (adamhj)
Assigned to: Nobody/Anonymous (nobody)
Summary: SimpleXMLRPCServer behave strangely in win32 service
Initial Comment:
i found that when i run a SimpleXMLRPCServer instance in a windows service(using pywin32 win32service module), the server will occasionally refuse xml rpc request.
----------------------------------------------------------------------
>Comment By: Mark Hammond (mhammond)
Date: 2010-08-30 12:38
Message:
Python has the same issue in many contexts, not only services (eg, in a GUI
app with no console attached). There is an open Python bug on this, and
IMO that is where it needs to be fixed.
Thanks for the report though!
----------------------------------------------------------------------
Comment By: adamhj (adamhj)
Date: 2010-04-30 12:17
Message:
ok, i think i have found where is the problem.
after found this problem using pywin32 service module, i turned to use a
wrapper service program (written in c# by me) to run my python script, and
then found similar problem, the difference is that when using my wrapper
service program, after certain number of client call, the xmlrpc port
hangs(any further client request is accepted but no response come out and
the tcp connection is not closed)
the wrapper service program is set to redirect stdout and stderr, but i'm
not sure if these codes can work correctly so i disable the pipe
redirection of the wrapper service and restart the service, to my surprise,
everything works right now.
then i recall that the SimpleXmlRpcServer module have a logRequests
parameter which is true by default will print a line of log message to
stdout for each client call, this may be will the problem start. so i set
logRequests to False in the test service script(the server.py i uploaded
previously) and run the test, no problem happens this time.
so this issue is caused by stdout output in a python script run as a
windows service, maybe some error is raised when the stdout buffer if full
and cause this unexpected behavior. still i am thinking this as a small bug
in pywin service module, as it should properly deal with the stdout/stderr
of running service script to avoid this problem.
----------------------------------------------------------------------
Comment By: adamhj (adamhj)
Date: 2010-04-30 01:20
Message:
and my testing environment is python 2.6.4, pywin32-214.win32-py2.6,
windows 2003 server(x86) with sp2
----------------------------------------------------------------------
Comment By: adamhj (adamhj)
Date: 2010-04-30 01:16
Message:
sorry, i'm using sf tracker for the first time and mistake the post button
for upload attachment button.
the bad response behavior (of SimpleXMLRPCServer in service) does not
happen everytime but appears regularly, it seems it will occurs every a few
calls
the attachment i uploaded yet is my testing script of the server side, and
the client side is a simple loop:
#----------------------------------------------------------------------
#client.py
import xmlrpclib
s = xmlrpclib.ServerProxy('http://localhost:8000')
while True:
print s.func0()
#----------------------------------------------------------------------
way to product the bug:
1. install server.py as windows service:
python server.py install
2. start the service in service manager
3. run client.py in console:
python client.py > output.txt
and after a few calls, the error is raised:
Traceback (most recent call last):
File "D:\test\xmlrpcsvc\client.py", line 6, in <module>
print s.func0()
File "D:\Python26\lib\xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "D:\Python26\lib\xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "D:\Python26\lib\xmlrpclib.py", line 1243, in request
headers
xmlrpclib.ProtocolError: <ProtocolError for localhost:8000/RPC2: -1 >
i changed func0 to func1,2,3 to test different parameter type and size,
and all output.txt have exactly 37 lines, so it seems that this error will
happen every 38 client calls
sniffer shows that in the failed session, the server will close the
connection(TCP FIN) just after receive client request, without sending any
response data or error info
this behavior only exists in windows service process, when running a
SimpleXMLRPCServer from console script, this does not happen, so i think
maybe this is some issue in pywin32 service module
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=2994205&group_id=78018
|