Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Python (http://www.programmingforums.org/forum43.html)
-   -   CherryPy Upload Timeout (http://www.programmingforums.org/showthread.php?t=10758)

Sane Jul 18th, 2006 1:46 PM

CherryPy Upload Timeout
 
Bah. Now this problem is really starting to piss me off. It has been an ongoing occurance for the last 5 to 6 months now.

Sometimes when a user tries to upload something on my site, it times out. Then the further you get away from my server, the less likely you are to time out. Since I am on the same network, it never does for me. People in Malaysia time out constantly.

However! It works perfectly if I kill the server. Kill all the Python processes (yes, I don't know why there are other subprocesses still running...). Then restart the server. Then it works anywhere.

I tried googling for other people having the same issue, I found one ticket that said the temporary file (used as an intermediate stage between the source and the destination), was never being closed. However, that ticket was in September, and I reinstalled CherryPy some time in February I believe.

It's not necessary to post my code, because it is in no way different than what they tell you to use in the CherryPy documentation.

Is this a problem with my Internet Service Provider? My internet connection? My CherryPy configuration?

:

conf = dict()
conf['global'] = {
        'server.socketPort': 80,
        'logDebugInfoFilter.on': False,
        'server.threadPool': 50,
        'staticFilter.root': ''
                }

...

cherrypy.config.update(conf)


It is CherryPy 2.1.0 if I am not mistaken.

Arevos Jul 18th, 2006 2:40 PM

Have you tried upgrading to the latest version (2.2.1 last I checked)?

Edit: Other than that, maybe:
:

cherrypy.server.socket.settimeout(20)
Would work.

Sane Jul 18th, 2006 2:53 PM

That sounded like a good idea, and it would work, but I get an attribute error. Server doesn't have the variable socket.

I'll try googling for how to set the timeout in CherryPy. There might be a better/different way.

Arevos Jul 18th, 2006 3:32 PM

Even if the socket was accessable directly from the server, it's the listening socket, not the connecting one, so it would have no effect.

I've looked through the code, and in 2.1.0 at least, there is no timeout set on the connecting socket. Nor is any default timeout set in the CherryPy source, according to a quick grep I ran.

So try putting this at the top of your code:
:

import socket
socket.setdefaulttimeout(20)

(20 being the number of seconds your application will wait for a response before timing out - I believe 10 is the default).

This is assuming that the timeout takes place at the TCP layer, of course.

Sane Jul 18th, 2006 4:36 PM

I added that. I got someone from down in the US to upload something successfully. It worked. But of course, there are 340 files that have uploaded without a hinge previously. I'll have to wait to see if I get complaints to determine if this solved the problem. Thanks. :)

Arevos Jul 18th, 2006 4:47 PM

If it doesn't work, try setting timeout to 60. If it still doesn't work, then... well, in that case it's probably not a good solution :)


All times are GMT -5. The time now is 12:55 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC