Forum

Internel server errors

Marco Spiga
16 June 2009, 18:46

Hiawatha version: Hiawatha v6.14.1, cache, IPv6, SSL, URL toolkit
Operating System: Ubuntu Jaunty 9.04
Kernel Version: 2.6.29.4-skumpic-v5-aao (compiled for acer one)

Hello.

I have this problem, when I try to print this script with permissions 755:
#!/bin/sh

echo "Content-Type: text/plain"
echo ""
printenv

I see this error log:
Tue 16 Jun 2009 17:17:14 +0200|128.0.0.1|/var/www/hiawatha/cgi-bin/printenv.cgi|no output

Another problem is when I run perl script cgi through hiawatha, I see this error log:
Tue 16 Jun 2009 17:50:25 +0200|128.0.0.1|/var/www/hiawatha/cgi-bin/myscript.cgi|error while forking CGI process

Script work fine when I run command: perl /var/www/hiawatha/cgi-bin/myscript.cgi

Same server version, same directory content, same permissions and same file config work fine on Ubuntu Intrepid Ibex with kernel 2.6.27 ....

Can you tell me where I'm wrong?
Hugo Leisink
16 June 2009, 22:34
The 'no output' error means that the CGI process printed no output. Does the environment contain variables? Try adding an echo "Hello world" to make sure the CGI has output.

How Hiawatha executes a CGI program/script is based on the extension of the file. If you used "CGIhandler = cgi", then the extension .cgi is used for CGI programs which can be executed directly. So your myscript.cgi perl script must start with "#!/usr/bin/perl".

Another way to execute perl scripts is to give perl scripts the extension .pl and use "CGIhandler = /usr/bin/perl:pl". In that case, the #!/usr/bin/perl is not necessary, because Hiawatha will run /usr/bin/perl with the CGI script as the parameter.
Marco Spiga
17 June 2009, 22:57
I have modified printenv.cgi whith "Hello world". . . . Same problem :-(
and the error log: error while forking CGI process?
Hogo, I remember you that Same server version, same directory content, same permissions and same file config work
fine on Ubuntu Intrepid Ibex with kernel 2.6.27.
Hugo Leisink
17 June 2009, 23:20
The "error while forking CGI process" indicates an OS error. Or fork() failed or pipe() failed. I have no idea why. Have you applied some security patch to your kernel or is there any other security mechanism active that might block Hiawatha?
Marco Spiga
18 June 2009, 13:01
No Hugo AppArmor is disabled. I don't if this can help you,
but other server like postgres, freeradius work fine.
I don't have tried with apache because I don't known very much it.
Marco
18 June 2009, 20:39
Same problem over Ubuntu 9.04 and ufficial Kernel. :-(((
Hugo Leisink
19 June 2009, 02:30
Never had any problems with Hiawatha under Ubuntu 9.04. The fact that you get the "error while forking CGI process" error indicates that the OS is somehow not letting Hiawatha spawn a new process. It's hard for me to say why while I'm not on that machine....
Marco
22 June 2009, 13:33
Thank you very much Hugo. I try also other ways to solve this problem.
Marco
23 June 2009, 18:41
Hello Hugo, I have solved!

I have change to other custom kernel and the error NO OUTPUT was generated by my error configuration in httpd.conf (the path of cgi-wrapper was wrong).

Unfortunately, the error type in file error.log not allowed me to understand.

Hugo Leisink
23 June 2009, 19:23
Can you post the message in error.log and your httpd.conf?
Marco Spiga
18 July 2009, 10:50
Hi Hugo. I feel sorry for the delay, but it was impossible for me to first.
here they are:
Tue 16 Jun 2009 10:45:55 +0200|128.0.0.1|/var/www/hiawatha/perl/login.cgi|error
while forking CGI process
Tue 16 Jun 2009 11:14:21 +0200|128.0.0.1|/var/www/hiawatha/perl/login.cgi|no output
Tue 16 Jun 2009 11:14:31 +0200|128.0.0.1|/var/www/hiawatha/perl/login.cgi|error
while forking CGI process
Tue 16 Jun 2009 16:59:38 +0200|128.0.0.1|/var/www/hiawatha/perl/login.cgi|execute CGI: No such file or directory
Tue 16 Jun 2009 16:59:38 +0200|128.0.0.1|/var/www/hiawatha/perl/login.cgi|no output
Tue 16 Jun 2009 17:01:32 +0200|128.0.0.1|/var/www/hiawatha/perl/login.cgi|error
while forking CGI process
Tue 16 Jun 2009 17:01:56 +0200|128.0.0.1|/var/www/hiawatha/perl/login.cgi|no output
The old file httpd.conf have already been corrected but I can tell you
that I have only change the path of the cgi-wrapper's location.
Many Thanks Hugo
Hugo Leisink
18 July 2009, 13:22
The only reason for a "error while forking CGI process" messages, is because of a pipe() error or a fork() error. You can check Hiawatha's code for it. Both are system calls. If they fail, Hiawatha can't execute the CGI program. This is not a Hiawatha issue, but an operating system issue. If a system call fail, there is an issue outside the calling program. Most of the time it's an access rights issue. But I have no idea why your OS is failing on a pipe() or a fork().....
This topic has been closed.