Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4552186
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:44:44+00:00 2026-05-21T16:44:44+00:00

I have a web page that sends a request to a cgi script that

  • 0

I have a web page that sends a request to a cgi script that basically has to tar and compress huge directories that might be over 50G. I am forking a process in my cgi script that does the tarring up task while I send a response msg to the web page in my parent script. However, the parent script (even in the absence of waitpid($pid, 0) waits for the tar process to be over and then sends the msg to the web page which is then printed via an alert box. Is there a way I can send the msg right away so that the user knows that the tarring up process has been initiated and that process can go on in the background. I don’t want to do an exec() as I need to catch any errors while creating this tar ball.

Also, will there be any memory issues while I try to tar such big directories?

$SIG{CHLD} = 'IGNORE';
$|++;
$pid = fork();
if($pid){ sendResponse($data); exit; }
elsif($pid == 0)
{
    setsid();
    $gpid = fork();
    if(! $gpid)
    {
        qx(tar up big directories over 50G...);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T16:44:44+00:00Added an answer on May 21, 2026 at 4:44 pm

    Your initial “status” response to the client is likely being buffered somewhere. If the CGI executor is designed properly, an unbuffered output stream or request to flush a stream should result in all packets being sent to the client (where they might get buffered by whatever is receiving, but that is beyond your control).

    See the Perl FAQ How do I flush/unbuffer an output filehandle? Why must I do this? for how to not buffer your initial response.

    Please note that the CGI environment is also likely calling waitpid() or similar, which is why you aren’t seeing results until after the child process exists. If you want a child process to persist after the request or client has gone away, you will need to disassociate the child process from the parent. See Complete Dissociation of Child from Parent in perlipc.

    Since you will be dealing with extremely large amounts of data (50G), this will take quite some time. It is very likely the client or server may hit some kind of timeout while waiting for tar to finish. To avoid this, you can ensure both client and server have insanely long timeouts, or periodically send data between the two to keep the connection/request alive. You may want to consider having the tar process disassociate and having the client periodically poll the server for the result.

    Finally, assuming tar is not writing to an in-memory buffer, it should be relatively memory efficient (assuming modern hardware). However, it could consume a lot of CPU and I/O. I would definitely be cautious about the security of the service and potential for (inadvertent) denial of service.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service that performs a database search. It accepts both GET
I'm building a component of a web page that needs relatively constant database polling.
I have a decent sized chunk of .NET code that now needs to be
I have 2 login controls on a web application one on default and one
I have a background service running which sends out emails to users of my
Scenerio - I am writting a web app that based off of which login
Real World Problem: I have my app hosted on Heroku , who (to my
I'm working on a web form which works in a following way. Read email
I'm building a Webapp that uses OpenId to authenticate users, like Stackoverlfow does. There
I want to provide status updates during a long-running task on an ASP.NET WebForms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.