• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 134
  • Last Modified:

CGIs, file locking and execution life

Okay heres the setup -- running CGI scripts on a Linux box with Apache (suexec enabled).  Script is a compiled C script using database files and flock to insure integrity.  What happens if in the middle of a database update the client hits escape in the browser?  Does the execution terminate immediatly ?  That works for flock, but what about the integrity of the database transacation ?  If it does die instantly then whats the way around it ?  Could forked / spawned CGI processes be the answer?  Gotta lot of questions -- need the info.
1 Solution
Fear not. Once the user sends the form/request any other action they take is irrelevent. Your CGI will continue until completion. What may happen is that there browser may close any open connection in which case the server will not send the output from your CGI to them but it won't actually terminate the CGI (CGIs are normally spawned anyhow). Consequently the database integrity is safe.


This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.  You'll also find a link there for Experts who wish to participate in the cleanup effort of old and abandoned questions.

Thank you,
Moderator @ Experts Exchange

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.

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