Thread: Help with timeouts
Folks, I have a very complex database operation that can sometimes take 70-90 seconds to return results. The web page which displays the results, however, seems to always timeout at 60seconds despite setting the Apache timeout to 300 seconds and set_time_limit to 240. My client is going berserk. $50 (USD) to the non-political charity of your choice if you can give me a suggestion that works. SuSE Linux 7.2 PostgreSQL 7.1.2 PHP 4.0.3 -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco
Folks, Some answers: > I have a very complex database operation that can sometimes take > 70-90 > seconds to return results. The web page which displays the results, > however, seems to always timeout at 60seconds despite setting the > Apache > timeout to 300 seconds and set_time_limit to 240. After a helpful web guru called us up from our post, we were able to diagnose what's happening here (donation to be announced later): Regardless of the Timeout and set_time_limit() settings, most browsers will time out at 60 seconds. This is obviously a huge annoyance. Therefore I am offering a *second* charity prize to any person who can give me code (PHP or Perl) which will display a "Processing" screen with an auto-reload to keep the browser interested while waiting 60 to 120 seconds for a database response in the background. *Someone* must have done this already, even though multi-threading in PHP & Perl is nigh impossible. -Josh Berkus
Attachment
I think the assumption is incorrect. Is the browser reporting the timeout, or is the webserver telling the browser it timed out? As an example of a difference, IE will display a local page saying the connection timed out, whereas if the page is actually displayed by the wbserver, it is the server that finally killed the connection. Again, as I said before, look at your php.ini file specifically this parameter: max_execution_time = 30 ; Maximum execution time of each script, in seconds If a script takes longer than that number, it will kill it. This is to prevent infinite loops. Up this number and you should be ok. I've had browsers that have sat for well over a minute on a stalled page. Again, breast cancer research for both donations. Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Josh Berkus" <josh@agliodbs.com> To: <pgsql-php@postgresql.org> Sent: Friday, October 05, 2001 11:26 AM Subject: Re: [PHP] Help with timeouts > Folks, > > Some answers: > > > I have a very complex database operation that can sometimes take > > 70-90 > > seconds to return results. The web page which displays the results, > > however, seems to always timeout at 60seconds despite setting the > > Apache > > timeout to 300 seconds and set_time_limit to 240. > > After a helpful web guru called us up from our post, we were able to > diagnose what's happening here (donation to be announced later): > > Regardless of the Timeout and set_time_limit() settings, most browsers > will time out at 60 seconds. > > This is obviously a huge annoyance. Therefore I am offering a *second* > charity prize to any person who can give me code (PHP or Perl) which > will display a "Processing" screen with an auto-reload to keep the > browser interested while waiting 60 to 120 seconds for a database > response in the background. *Someone* must have done this already, even > though multi-threading in PHP & Perl is nigh impossible. > > -Josh Berkus > ---------------------------------------------------------------------------- ---- > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >
Ooops! I realise I sent my original answer to a wrong list. Sorry. ---------------------------------------------------------------------------- - Look at the script timeout settings in php.ini... not the httpd.conf. Send the $50 a breast cancer charity... or me. Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Josh Berkus" <josh@agliodbs.com> To: <pgsql-php@postgresql.org> Sent: Friday, October 05, 2001 11:26 AM Subject: Re: [PHP] Help with timeouts > Folks, > > Some answers: > > > I have a very complex database operation that can sometimes take > > 70-90 > > seconds to return results. The web page which displays the results, > > however, seems to always timeout at 60seconds despite setting the > > Apache > > timeout to 300 seconds and set_time_limit to 240. > > After a helpful web guru called us up from our post, we were able to > diagnose what's happening here (donation to be announced later): > > Regardless of the Timeout and set_time_limit() settings, most browsers > will time out at 60 seconds. > > This is obviously a huge annoyance. Therefore I am offering a *second* > charity prize to any person who can give me code (PHP or Perl) which > will display a "Processing" screen with an auto-reload to keep the > browser interested while waiting 60 to 120 seconds for a database > response in the background. *Someone* must have done this already, even > though multi-threading in PHP & Perl is nigh impossible. > > -Josh Berkus > ---------------------------------------------------------------------------- ---- > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >
Also, that whole auto-load is theoretically impossible... You "reload the page" and you are restarting the script from scratch. Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Josh Berkus" <josh@agliodbs.com> To: <pgsql-php@postgresql.org> Sent: Friday, October 05, 2001 11:26 AM Subject: Re: [PHP] Help with timeouts > Folks, > > Some answers: > > > I have a very complex database operation that can sometimes take > > 70-90 > > seconds to return results. The web page which displays the results, > > however, seems to always timeout at 60seconds despite setting the > > Apache > > timeout to 300 seconds and set_time_limit to 240. > > After a helpful web guru called us up from our post, we were able to > diagnose what's happening here (donation to be announced later): > > Regardless of the Timeout and set_time_limit() settings, most browsers > will time out at 60 seconds. > > This is obviously a huge annoyance. Therefore I am offering a *second* > charity prize to any person who can give me code (PHP or Perl) which > will display a "Processing" screen with an auto-reload to keep the > browser interested while waiting 60 to 120 seconds for a database > response in the background. *Someone* must have done this already, even > though multi-threading in PHP & Perl is nigh impossible. > > -Josh Berkus > ---------------------------------------------------------------------------- ---- > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >
Hello, from the PHP manual: " Note: The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), the sleep() function, database queries, etc. is not included when determining the maximum time that the script has been running. " So is there anything you forgot to mention ;) I mean everything works fine except this query or you couldn't test the page without the result. Have you tried to optimize this query? Maybe post to this list and wait for some suggestions... ----- Original Message ----- From: "Josh Berkus" <josh@agliodbs.com> To: <pgsql-php@postgresql.org> Sent: Friday, October 05, 2001 1:12 AM Subject: [PHP] Help with timeouts > Folks, > > I have a very complex database operation that can sometimes take 70-90 > seconds to return results. The web page which displays the results, > however, seems to always timeout at 60seconds despite setting the Apache > timeout to 300 seconds and set_time_limit to 240. > > My client is going berserk. $50 (USD) to the non-political charity of > your choice if you can give me a suggestion that works. > > SuSE Linux 7.2 > PostgreSQL 7.1.2 > PHP 4.0.3 > > -Josh Berkus > > > > ______AGLIO DATABASE SOLUTIONS___________________________ > Josh Berkus > Complete information technology josh@agliodbs.com > and data management solutions (415) 565-7293 > for law firms, small businesses fax 621-2533 > and non-profit organizations. San Francisco > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
Hmmm.... that's odd. I had a friend that had a query that took a long time and we changed that and it worked... weird. Well, ignore my posts then. Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Papp Gyozo" <pgerzson@freestart.hu> To: "Josh Berkus" <josh@agliodbs.com>; <pgsql-php@postgresql.org> Sent: Friday, October 05, 2001 12:16 PM Subject: Re: [PHP] Help with timeouts > > Hello, > > from the PHP manual: > " > Note: The set_time_limit() function and the configuration directive > max_execution_time only affect the execution time of the script itself. Any > time spent on activity that happens outside the execution of the script such > as system calls using system(), the sleep() function, database queries, etc. > is not included when determining the maximum time that the script has been > running. > " > > So is there anything you forgot to mention ;) > I mean everything works fine except this query or you couldn't test the page > without the result. > > Have you tried to optimize this query? > Maybe post to this list and wait for some suggestions...
If he was using set_time_limit() it should have overridden the max_execution_time configuration in php.ini though, right? It seems to work for me, I use set_time_limit(1000) in a few places (especially in the reports) of the app I'm working on right now and it seems to do just what http://www.php.net/manual/en/function.set-time-limit.php says it should.. Perhaps I'm doing something else different though... You should keep your money, these lists are here for such help! Good luck! -Mitch ----- Original Message ----- From: "Adam Lang" <aalang@rutgersinsurance.com> To: <pgsql-php@postgresql.org> Sent: Friday, October 05, 2001 11:59 AM Subject: Re: [PHP] Help with timeouts > I think the assumption is incorrect. Is the browser reporting the timeout, > or is the webserver telling the browser it timed out? > > As an example of a difference, IE will display a local page saying the > connection timed out, whereas if the page is actually displayed by the > wbserver, it is the server that finally killed the connection. > > Again, as I said before, look at your php.ini file > > specifically this parameter: > > max_execution_time = 30 ; Maximum execution time of each script, in > seconds > > If a script takes longer than that number, it will kill it. This is to > prevent infinite loops. Up this number and you should be ok. > > I've had browsers that have sat for well over a minute on a stalled page. > > Again, breast cancer research for both donations. > > > > Adam Lang > Systems Engineer > Rutgers Casualty Insurance Company > http://www.rutgersinsurance.com > ----- Original Message ----- > From: "Josh Berkus" <josh@agliodbs.com> > To: <pgsql-php@postgresql.org> > Sent: Friday, October 05, 2001 11:26 AM > Subject: Re: [PHP] Help with timeouts > > > > Folks, > > > > Some answers: > > > > > I have a very complex database operation that can sometimes take > > > 70-90 > > > seconds to return results. The web page which displays the results, > > > however, seems to always timeout at 60seconds despite setting the > > > Apache > > > timeout to 300 seconds and set_time_limit to 240. > > > > After a helpful web guru called us up from our post, we were able to > > diagnose what's happening here (donation to be announced later): > > > > Regardless of the Timeout and set_time_limit() settings, most browsers > > will time out at 60 seconds. > > > > This is obviously a huge annoyance. Therefore I am offering a *second* > > charity prize to any person who can give me code (PHP or Perl) which > > will display a "Processing" screen with an auto-reload to keep the > > browser interested while waiting 60 to 120 seconds for a database > > response in the background. *Someone* must have done this already, even > > though multi-threading in PHP & Perl is nigh impossible. > > > > -Josh Berkus > > > > > -------------------------------------------------------------------------- -- > ---- > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 4: Don't 'kill -9' the postmaster > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >
Papp, > So is there anything you forgot to mention ;) > I mean everything works fine except this query or you couldn't test > the page > without the result. Nope. Just waitin' for the query. There's a couple of things that make us believe it's the browser: 1. The timeout message on Konqueror is a dialog box, not a web page. 2. Sometimes (we think) the query returns in just under 60 seconds (it's been clocked from the command line at 55) and it takes a few more seconds for the server to generate the HTML. The browser still times out. > Have you tried to optimize this query? > Maybe post to this list and wait for some suggestions... It's a procedure, actually, with about 16 steps. It's likely that we'll break it down into 3-4 sub procedures for "progress reporting" purposes. This will slow down the process overall but prevent browser timeouts. -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco
Have you tried viewing it in a different browser? Read this from the KDE FAQ: Is there a way to change the timeout values in Konqueror ? Beginning with 2.2 beta series, you can change the timeout settings in the control panel under "Network->Preferences". If you are using the 2.1 series, however, you have to manipulate the config file manually to adjust these values to your liking. Here is the procedure for doing that: Open $KDEHOME/share/config/kioslaverc in your favorite editor, where $KDEHOME is your local kde config directory (usually ~/.kde/). Add the following entries without any HEADING, i.e outside of any [] block. Simply adding it to the top of the file will suffice. ReadTimeout=x // length of time to wait for arrival of requested data ResponseTimeout=x // length of time to wait for a response after sending a request ConnectTimeout=x // length of time to wait for response after attempting to connect ProxyConnectTimeout=x // same a above except it is used for proxy servers. where x is the value you need in seconds. To give you an idea, here are the default values: DEFAULT_READ_TIMEOUT 15 // 15 SECONDS DEFAULT_RESPONSE_TIMEOUT 60 // 1 MINUTE DEFAULT_CONNECT_TIMEOUT 20 // 20 SECONDS DEFAULT_PROXY_CONNECT_TIMEOUT 10 // 10 SECONDS Manually run the following command to update any running io-slaves: dcop konqueror KIO::Scheduler reparseConfiguration() "" If you are running older than version 2.1 of KDE, upgrade. Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Josh Berkus" <josh@agliodbs.com> To: <pgsql-php@postgresql.org> Sent: Friday, October 05, 2001 12:55 PM Subject: Re: [PHP] Help with timeouts > Papp, > > > So is there anything you forgot to mention ;) > > I mean everything works fine except this query or you couldn't test > > the page > > without the result. > > Nope. Just waitin' for the query. > > There's a couple of things that make us believe it's the browser: > > 1. The timeout message on Konqueror is a dialog box, not a web page. > 2. Sometimes (we think) the query returns in just under 60 seconds (it's > been clocked from the command line at 55) and it takes a few more > seconds for the server to generate the HTML. The browser still times > out. > > > Have you tried to optimize this query? > > Maybe post to this list and wait for some suggestions... > > It's a procedure, actually, with about 16 steps. It's likely that we'll > break it down into 3-4 sub procedures for "progress reporting" purposes. > This will slow down the process overall but prevent browser timeouts. > > -Josh > > > ______AGLIO DATABASE SOLUTIONS___________________________ > Josh Berkus > Complete information technology josh@agliodbs.com > and data management solutions (415) 565-7293 > for law firms, small businesses fax 621-2533 > and non-profit organizations. San Francisco > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >
Adam, > Have you tried viewing it in a different browser? Actually, the client is using IE 5.03, and having the same problem. We were mainly looking for the timeout setting in IE, which does not seem to exist. > Read this from the KDE FAQ: > > Is there a way to change the timeout values in Konqueror ? > Beginning with 2.2 beta series, you can change the timeout settings > in the > control panel under "Network->Preferences". Thank you. This will allow us to tell definitively whether or not it is the browser. That RESPONSE_TIMEOUT of 60 is highly suspicious, though. -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco
It looks like IE's timeout is 5 minutes. http://www.windows-help.net/windows98/ie40-29.shtml Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Josh Berkus" <josh@agliodbs.com> To: <pgsql-php@postgresql.org> Cc: <erez@erezascher.com> Sent: Friday, October 05, 2001 1:12 PM Subject: Re: [PHP] Help with timeouts > Adam, > > > Have you tried viewing it in a different browser? > > Actually, the client is using IE 5.03, and having the same problem. We > were mainly looking for the timeout setting in IE, which does not seem > to exist. > > > Read this from the KDE FAQ: > > > > Is there a way to change the timeout values in Konqueror ? > > Beginning with 2.2 beta series, you can change the timeout settings > > in the > > control panel under "Network->Preferences". > > Thank you. This will allow us to tell definitively whether or not it is > the browser. That RESPONSE_TIMEOUT of 60 is highly suspicious, though. > > -Josh > > > ______AGLIO DATABASE SOLUTIONS___________________________ > Josh Berkus > Complete information technology josh@agliodbs.com > and data management solutions (415) 565-7293 > for law firms, small businesses fax 621-2533 > and non-profit organizations. San Francisco > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >
Is it possible for us to go to the site and see the error message? Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Josh Berkus" <josh@agliodbs.com> To: <pgsql-php@postgresql.org> Sent: Friday, October 05, 2001 12:55 PM Subject: Re: [PHP] Help with timeouts > Papp, > > > So is there anything you forgot to mention ;) > > I mean everything works fine except this query or you couldn't test > > the page > > without the result. > > Nope. Just waitin' for the query. > > There's a couple of things that make us believe it's the browser: > > 1. The timeout message on Konqueror is a dialog box, not a web page. > 2. Sometimes (we think) the query returns in just under 60 seconds (it's > been clocked from the command line at 55) and it takes a few more > seconds for the server to generate the HTML. The browser still times > out. > > > Have you tried to optimize this query? > > Maybe post to this list and wait for some suggestions... > > It's a procedure, actually, with about 16 steps. It's likely that we'll > break it down into 3-4 sub procedures for "progress reporting" purposes. > This will slow down the process overall but prevent browser timeouts. > > -Josh
Yes, I'm also very curious now... Or can you post anything related to this error? ----- Original Message ----- From: "Adam Lang" <aalang@rutgersinsurance.com> To: <pgsql-php@postgresql.org> Sent: Friday, October 05, 2001 7:38 PM Subject: Re: [PHP] Help with timeouts > Is it possible for us to go to the site and see the error message? > > Adam Lang > Systems Engineer > Rutgers Casualty Insurance Company > http://www.rutgersinsurance.com > ----- Original Message ----- > From: "Josh Berkus" <josh@agliodbs.com> > To: <pgsql-php@postgresql.org> > Sent: Friday, October 05, 2001 12:55 PM > Subject: Re: [PHP] Help with timeouts > > > > Papp, > > > > > So is there anything you forgot to mention ;) > > > I mean everything works fine except this query or you couldn't test > > > the page > > > without the result. > > > > Nope. Just waitin' for the query. > > > > There's a couple of things that make us believe it's the browser: > > > > 1. The timeout message on Konqueror is a dialog box, not a web page. > > 2. Sometimes (we think) the query returns in just under 60 seconds (it's > > been clocked from the command line at 55) and it takes a few more > > seconds for the server to generate the HTML. The browser still times > > out. > > > > > Have you tried to optimize this query? > > > Maybe post to this list and wait for some suggestions... > > > > It's a procedure, actually, with about 16 steps. It's likely that we'll > > break it down into 3-4 sub procedures for "progress reporting" purposes. > > This will slow down the process overall but prevent browser timeouts. > > > > -Josh > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html
I'm guessing though if Konqueror generated a pop up box mention timeout, it is the browser that is timing out. Otherwise Apache/PHP would send a HTML page saying connection timed out. I'm surprised the default for Konqueror is one minute. A little low in this time of dynamic websites. Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Papp Gyozo" <pgerzson@freestart.hu> To: <pgsql-php@postgresql.org> Sent: Friday, October 05, 2001 1:57 PM Subject: Re: [PHP] Help with timeouts > Yes, I'm also very curious now... > Or can you post anything related to this error? > > ----- Original Message ----- > From: "Adam Lang" <aalang@rutgersinsurance.com> > To: <pgsql-php@postgresql.org> > Sent: Friday, October 05, 2001 7:38 PM > Subject: Re: [PHP] Help with timeouts > > > > Is it possible for us to go to the site and see the error message? > > > > Adam Lang > > Systems Engineer > > Rutgers Casualty Insurance Company > > http://www.rutgersinsurance.com > > ----- Original Message ----- > > From: "Josh Berkus" <josh@agliodbs.com> > > To: <pgsql-php@postgresql.org> > > Sent: Friday, October 05, 2001 12:55 PM > > Subject: Re: [PHP] Help with timeouts > > > > > > > Papp, > > > > > > > So is there anything you forgot to mention ;) > > > > I mean everything works fine except this query or you couldn't test > > > > the page > > > > without the result. > > > > > > Nope. Just waitin' for the query. > > > > > > There's a couple of things that make us believe it's the browser: > > > > > > 1. The timeout message on Konqueror is a dialog box, not a web page. > > > 2. Sometimes (we think) the query returns in just under 60 seconds (it's > > > been clocked from the command line at 55) and it takes a few more > > > seconds for the server to generate the HTML. The browser still times > > > out. > > > > > > > Have you tried to optimize this query? > > > > Maybe post to this list and wait for some suggestions... > > > > > > It's a procedure, actually, with about 16 steps. It's likely that we'll > > > break it down into 3-4 sub procedures for "progress reporting" purposes. > > > This will slow down the process overall but prevent browser timeouts. > > > > > > -Josh > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org >
On Fri, Oct 05, 2001 at 02:03:15PM -0400, Adam Lang wrote: > I'm guessing though if Konqueror generated a pop up box mention timeout, it > is the browser that is timing out. Otherwise Apache/PHP would send a HTML > page saying connection timed out. I'm surprised the default for Konqueror > is one minute. A little low in this time of dynamic websites. I dunno. To me, one minute seems to be an awfully long time for a "dynamic" website. -- Adam Haberlach | adam@newsnipple.com | Not all who wander are lost. | |