lx-office on Hiawatha

26 May 2009, 12:39
Hello all esp. Hugo,

first of all thanks for the great work.

I have a problem with running lx-office (a german split-off of sql-ledger) on

I do get the login page and shows up as wanted, but when going to the admin page I get an CGI Timeout (even with a setting of 180) :

Tue 26 May 2009 12:15:12 +0200||/var/www/lx-office-erp/|CGI timeout

it does work on Apache so I wonder what it might be ... can I somehow get more detailed informations?
could it be a header bug?

thanks in advance,
Hugo Leisink
26 May 2009, 16:31
If you set TimeForCGI to 180, does it than also take 180 seconds before Hiawatha kills the CGI program and logs the "CGI timeout" message? Or already after a few seconds?
26 May 2009, 19:41
it does take the 180 seconds until it returns the error ...
Hugo Leisink
26 May 2009, 22:09
Well, in that case the problem must be in your CGI program. How is the processor load during those 180 seconds?

I advice you to print debug information to a logfile throughout in order to pinpoint the exact line of code that is causing to wait forever. (if a certain debug line is not printed, that line of code wasn't reached)
26 May 2009, 22:16
thanks Hugo,

I just wonder that it does work on apache and does stop running and print me a nice admin page

(same machine, same files on hd ... once hiawatha once apache)

any Ideas are welcome ... while waiting I will start debugging
Hugo Leisink
26 May 2009, 23:01
Start by looking at the processor load during the request. Hiawatha has forked and started So, somewhere in your process list, a as a child of Hiawatha must be present. What is the processor load of that process?

If it's very high, is looping on some code. Look for for-loops in the code. If the load is zero, is waiting on something. Most likely on the return of a system call. My guess is that that system call has something to do with reading the HTTP request, like reading from stdin.

My way of debugging woud be: locate the start of the script and insert a write-some-text-to-logfile statement. Reload the browser and see if the logfile has the 'text'. If it has, move the log-statement a few lines down in the code. Repeat that step until a browser-refresh doesn't add the text to the logfile. You've come to a point the script execution doesn't reach. If can tell me where that point is, I'll take a look in the code for you to see what's going wrong.
27 May 2009, 20:30
the processor load was close to zero and I hunted down the line to the following:


which does not return.


if you need some more informations tell me and I will be glad to give them to you.

thanks for your help, Hugo

groetjes uit duitsland

27 May 2009, 20:35
just tried the following:

read(STDIN, $_, 1);

and it didn't return either

27 May 2009, 21:10
did check the $ENV{REQUEST_METHOD} and it is POST
Hugo Leisink
27 May 2009, 21:45
I tried downloading lx-office-erp, but the zip file contains a lot of zero-sized files. is also empty..... Can you share (and the rest of the code) with me?
27 May 2009, 21:57
those files are links under linux is a symbolic link to

then /bin/mozilla/ is included, which includes SL/
and in new() of the read is performed

if you still need some code please let me know and I will past it on some bin

Hugo Leisink
27 May 2009, 22:41
I've downloaded the package and taken a look at the source...... now I remember why I hate Perl so much. This is nasty ugly code!!

I unzipped the zipfile and pointed my browser to it. All I get is
Wed 27 May 2009 20:39:36 +0200||/var/www/test/|Can't locate in @INC (@INC contains: modules/override /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl . modules/fallback) at SL/ line 58.|BEGIN failed--compilation aborted at SL/ line 58.|Compilation failed in require at bin/mozilla/ line 33.|BEGIN failed--compilation aborted at bin/mozilla/ line 33.|Compilation failed in require at /var/www/test/ line 89.
Wed 27 May 2009 20:39:36 +0200||/var/www/test/|no output

How do I get this ugly monster running? I don't know Perl very well, so you have to help me out on this one
27 May 2009, 23:16
neither do I know perl very well ;-)

you need a lot of perl packages ...

two of them are libtemplate-perl and libhtml-template-perl (for debian)

27 May 2009, 23:44
btw: the debug function you recommend:

sub log {
open(FILE,"> debug.out") or die("unable to open debug.out\n");
print FILE "$_[0]\n";

#calles like this:
log("this is an ugly code");

27 May 2009, 23:45
sub log {
# needs to be ">>" not ">" so each line is attached and not just the last line is in the file
open(FILE,">> debug.out") or die("unable to open debug.out\n");
print FILE "$_[0]\n";

#calles like this:
log("this is an ugly code");
Hugo Leisink
28 May 2009, 00:15
Next error I need some help with:

install_driver(Pg) failed: Can't locate DBD/ in @INC (@INC contains: modules/override /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl . modules/fallback) at (eval 25) line 3.|Perhaps the DBD::Pg perl module hasn't been fully installed,|or perhaps the capitalisation of 'Pg' isn't right.|Available drivers: AnyData, CSV, DBM, ExampleP, File, Proxy, Sponge, mysql.| at SL/ line 144
28 May 2009, 00:21
you need the pg driver
libdbi-perl and libdbd-pg-perl
Hugo Leisink
28 May 2009, 00:41
I've found the bug: when you submit a password, tries to read from stdin twice. It's done in on line 54 and in SL/ (included via bin/mozilla/ on line 234. If you disable the read() in SL/, it works. I was able to login with 'admin' as the password.

So, it's not a Hiawatha bug, but one in lx-office-erp.
28 May 2009, 00:55
thank you very much, Hugo.

I will post it as a bug on lx-office
29 May 2009, 10:16
Hello Hugo,

I did post it as a bug on lx-office and their Idea was that forked perl apps behave not the same way on hiawatha and apache ...

I will dig into it.

Hugo Leisink
29 May 2009, 12:04
I saw your forum post on their website. I believe that there are two things that caused this problem: they designed their website using Apache instead of using the web standards. Second: their design is bad. Reading the request should be done in a centrilized way. One piece of code that reads the request and makes it available to the rest of the website code. That's not what they did. Every piece of software should have a modular and structured design. This is what the lx-office code lacks.
29 May 2009, 13:10
thank you very much for your help Hugo

I guess I will have to stick to apache until I found something else or they changed their code, which is very unlikely
This topic has been closed.