You are hereForums / Bugs / program dies when RPC server is down

Finally, the wait is over!!! Videocache 2.0.0 is here :-) Check changelog for changes and new features in this version. Contact Us for your free upgrade!!

program dies when RPC server is down


5 replies [Last post]
Anonymous
program dies when RPC server is down

Hi,

When the RPC server is down or busy, the program will exit with such error:

Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib64/python2.4/threading.py", line 442, in __bootstrap
self.run()
File "/usr/share/videocache/videocache.py", line 792, in run
squid_part()
File "/usr/share/videocache/videocache.py", line 534, in squid_part
video_id_pool.add(video_id)
File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/lib64/python2.4/xmlrpclib.py", line 1129, in request
self.send_content(h, request_body)
File "/usr/lib64/python2.4/xmlrpclib.py", line 1243, in send_content
connection.endheaders()
File "/usr/lib64/python2.4/httplib.py", line 804, in endheaders
self._send_output()
File "/usr/lib64/python2.4/httplib.py", line 685, in _send_output
self.send(msg)
File "/usr/lib64/python2.4/httplib.py", line 652, in send
self.connect()
File "/usr/lib64/python2.4/httplib.py", line 636, in connect
raise socket.error, msg
error: (110, 'Connection timed out')

the line numbers may vary, depending on the stage in which the RPC server did not respond.

I suggest catching the exceptions, and just return the orignal URL to squid (if in squid_part), so service will continue to flow.

There is a small issue with this approach - if the RPC server is listening, and accepting connections, but does not respond to request - I couldn't find any variable that sets a "response timeout".sexcam kostenlos testen

admin's picture
Offline
Joined: Nov 2 2008

I'll have a look at it and try to catch exceptions at all stages. Thanks for the feedback :)

Anonymous (not verified)

I'm not much of a python programmer, but here is a diff containing my changes.

My changes includes more 'try' blocks for the RPC calls.
With further testing it seems that if SO_REUSEADDR is used with the RPC server, it will bind to the port, but on the next request, it will hang on recvfrom.

Therefore, I've removed the SO_REUSEADDR option, and instead made the script exit if it cannot bind to the port - squid will rerun the process, and at some point (when all the TIME_WAIT connections are closed) it would be able to rebind to the port, and start normally.

Your project is amazing, and I'm really really thankful for your efforts.

I think that the main weakness of the project lies within the RPC server - it is not robust, and doesn't recover from errors easily.

http://mariska.inter.net.il/~imriz/videocach.py.patch

admin's picture
Offline
Joined: Nov 2 2008

Thanks a lot Imriz for the patch. I have included all your suggestions in the base code. You'll will see all of them in the next version :)

Thanks for the compliments and suggestions.

Anonymous (not verified)

Hi Kulbir,

For some reason, the RPC server freezes after some time (could be a couple of hours). By freezing I mean that the RPC server TCP port answers (i.e. opens), but there is no response from the RPC server.

Could you please go over my changes and make sure I did not introduce a new bug? :)

admin's picture
Offline
Joined: Nov 2 2008

Yeah. Sure. I'll test it before committing :)

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <code>
  • Lines and paragraphs break automatically.
  • HTML tags will be transformed to conform to HTML standards.
  • Search Engines will index and follow ONLY links to allowed domains.

More information about formatting options

CAPTCHA
Are you a human visitor ?
Image CAPTCHA
Enter the characters shown in the image.

My Book on Squid

Purchase/Renew

Go to Pricing page to purchase a new license or renew your existing license.

Recent comments

Who's online

There are currently 0 users and 202 guests online.