Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

SpeedyCGI waiting to timeout to finish running

We are running Apache 2.0 server on FreeBSD. All of our Perl code is running with SpeedyCGI with a MySQL database. We have noticed that sometimes a database entry may take up to 2 hours before it shows up in the database. What we found was that an employee gets anxious and closes out the web browser before the transaction is complete. It seems like the Perl script is just hanging in limbo and then at some unspecified time interval in the future it finishes and completes the database entries. Basically the script inserts some data into the table, performs a select to retrieve some data to present some info on the screen and inserts some more data into the database. The user Xs out of the browser during the select stage and then hours later the second sets of inserts get processed. It seems very odd but I can't find any information about the relation between Apache and Speedy that controls what happens in this situation. It's almost like Speedy is waiting until someone tries to connect to it before it finishes completing.
0
mastercraftowner
Asked:
mastercraftowner
  • 2
1 Solution
 
gheistCommented:
You have to do that in database transaction ideally.
Does problem show up with plain perl?
0
 
Adam314Commented:
The speedy will exit after the specified timeout, or after the specified number of executions.  This could be what causes it to eventually exit.

As for the data - do you have autocommit on for your database?  If so, as soon as the perl script runs (which inserts data in the database), the database will have the new data, and will not have to wait for anything.
0
 
mastercraftownerAuthor Commented:
Autocommit is on for the database. It always seems like the speedy thread sends the last insert query after it exits the process.
0
 
Adam314Commented:
Are you using set_shutdown_handler, add_shutdown_handler, or register_cleanup from the CGI::SpeedyCGI module?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now