Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Apache forbids fork() and thread()

by MARVion (Novice)
on Nov 13, 2012 at 12:16 UTC ( #1003596=perlquestion: print w/ replies, xml ) Need Help??
MARVion has asked for the wisdom of the Perl Monks concerning the following question:

Hi to all of you, I'm a student from Germany. Because this site helped me a lot in the past, I now have to ask a question for which I can't find a good answer through the whole Google. I have web based software running local on a Windows machine on a XAMPP server. The copy of that is running on a linux machine, also Apache server. I NEED to create a complete new free process but when I try forking or threading, perl breaks down and the complete software throws errors. Using a system call worked fine locally but needs a lot of time (it's a spearate *.pl script I am calling). So this is the reason why I need to run it indepentand from within the web based program. Is there any way, any possiblity, workaround or Apache modification resolving my problem? I also tried Proc::Daemon, but this also isn't working because of the simulation of a fork(). I also tried thread->detach but, for sure, it wasn't working at all. The error thrown is a standard 500 server error, with the text:Premature end of script headers. I'm looking forward to hear from you! It would be very nice if somebody could help me with that problem I have for about three days now. Yours sincerely MARV

Comment on Apache forbids fork() and thread()
Re: Apache forbids fork() and thread()
by afoken (Parson) on Nov 13, 2012 at 12:21 UTC

    Which system has this problem? Windows or Linux?

    Are you aware that Windows has neither fork() nor exec()? Are you aware that Apache uses different process models on Linux and Windows? This also affects mod_perl!

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      Hi, thanks for your quick reply. Both systems have this problem, that nothing is working when trying to fork() or thread. I tried all possible functions like, fork, exec, system with &, Proc::Daemon and other things on both machines. The functions which do not create a process or thread for their own like system() are working fine, but this causes a lot of delay due to the time the called script needs. I'm working with mod_perl, that's correct. Because I thought about the different behavoiurs of Apache I tried all possibilities on both systems. Greetz
Re: Apache forbids fork() and thread()
by marto (Chancellor) on Nov 13, 2012 at 12:29 UTC

    "The error thrown is a standard 500 server error"

    And what did the web server logging tell you? Regardless of the issues already pointed out, you need to do basic debugging to help locate where your problems are. See the debugging advice here.

      Hi, thanks for the links! I tried a lot of things (in the links you posted), Shell says Syntax is ok, there are no fatalsToBrowser errors displayed in the browser, just the header which is printed anyway. I compiled with -cwT, anything ok. When running the code without the fork statement, anything works fine, when running it with the fork statement anything collapsed, also Perl for itself. Windows is telling me Perl isn't working anymore and asks for sending some more information (what I denied). I think it's an environment problem of Apache, but I don't know it for sure as I'm not that familiar with server configurations. Greetz

        Hi, check out a file called error_log, check out the Apache documentation and that of your WAMP stack for it's location, or search for it as you would any other file.

        Update: Please don't remove questions having asked them, it makes replies look rather silly.

Re: Apache forbids fork() and thread()
by Anonymous Monk on Nov 13, 2012 at 12:38 UTC
      Hi, thanks for the links! I tried a lot of things (in the links you posted), Shell says Syntax is ok, there are no fatalsToBrowser errors displayed in the browser, just the header which is printed anyway. I compiled with -cwT, anything ok. When running the code without the fork statement, anything works fine, when running it with the fork statement anything collapsed, also Perl for itself. Windows is telling me Perl isn't working anymore and asks for sending some more information (what I denied). I think it's an environment problem of Apache, but I don't know it for sure as I'm not that familiar with server configurations. Greetz

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1003596]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (14)
As of 2014-09-19 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (135 votes), past polls