Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 18th, 2006, 12:46 PM   #1
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,869
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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.
Sane is offline   Reply With Quote
Old Jul 18th, 2006, 1:40 PM   #2
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
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.
Arevos is offline   Reply With Quote
Old Jul 18th, 2006, 1:53 PM   #3
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,869
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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.
Sane is offline   Reply With Quote
Old Jul 18th, 2006, 2:32 PM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
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.
Arevos is offline   Reply With Quote
Old Jul 18th, 2006, 3:36 PM   #5
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,869
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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.
Sane is offline   Reply With Quote
Old Jul 18th, 2006, 3:47 PM   #6
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
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
Arevos is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CherryPy Multiple Threads Sane Python 25 Feb 20th, 2006 8:22 PM
CherryPy with py2exe Sane Python 0 Feb 5th, 2006 12:01 PM
winsock troubles w/ upload file c0ldshadow C++ 2 Feb 3rd, 2006 9:00 PM
Upload a file by getting the file form drive bennyz12 ASP 1 Jul 29th, 2005 8:46 PM
Help with the file upload control Lipo HTML / XHTML / CSS 3 May 2nd, 2005 11:32 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:24 PM.

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