modperl_debugging_difficulties

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Subject: Re: RFC: mod_perl advocacy project resurrection
From: Stephen.A.Cochran@Cahir.net (Stephen A. Cochran)
Date: 06 Dec 2000 10:36:43 EST

[...]

Recently I was handed an online event calendar running under
CGI and asked to get it to run under mod_perl to speed it
up. I'm comfortable with perl, but by no means a guru. And
this was the first time using mod_perl. In the past I've
used several products which might be considered competitors
to mod_perl: Web Objects and Cold Fusion. CF was horrible,
I'm glad I didn't have to work with it for long. WO was very
nice to work with, and it had all the ecommerce and
transation logic needed to build a enterprise web
application quickly. (None of my work has been in ecommerce,
instead in the medical industry (patient data, lab results,
etc) which has many of the same requirements).

[...]

Technical Issues: The second problem I see with mod_perl is
a technical one. Because of the design of mod_perl,
debugging problems can be fairly involved. Is the problem my
code?  Or is it apache, or maybe mod_perl? Could even be
perl for that matter. Take for example the problem I ran
into recently. (Please don't take this as a rant just
because I had problems, I'm happy with mod_perl. But I'm
fairly capable around unix and compiling, instead imagine
this happening to someone who wasn't that comfortable.)

The event calendar works great under CGI, so I try it under
mod_perl. It was written to work under mod_perl by a better
perl programmer that I'll ever be (Jon Howell of Faq-o-matic
fame) and is very well designed. It even worked under
mod_perl with some minor changes like supplying the
user/pass to the database since it wasn't running under
cgiwrap any longer. And it worked! But only 90% of the time.

The other 10% of the time, the client received no data, and
the page generated by the script ended up in the apache
log. After cleaning up one implicit database handle
destruction warning the problem persisted, and I began to
attempt to discover where the connection was being
closed. So I did what any lazy programmer does, I added some
print statements to send a note to STDERR.  While these all
showed up when the program worked correctly, when problem
occured, the prints to STDERR dissapeared. But the html page
was printed to the apache log, basicly standard error. So it
looks like if the socket is closed, stderr dissapears, and
stdout goes to the error log. So no pointers appeared in the
log, which wasn't very helpful.

Next attempt was to do some packet sniffing to see why the
socket was closeing.  Turns out that the web server sends an
orderly release indication (T_ORDEL_IND = 132), so the
client being a good citizen reponds with a orderly release
request and there goes the socket.

While my description of the problem was more in-depth that I
meant it to be, my point is that now I'm left with the need
to trace through system calls made by apache, mod_perl and
my program to try and find who's asking the client to kill
the connection. It's a pain for me (expecially since this is
all running on Dec Unix which doesn't have a system call
trace funtion), I can't imagine what it would be like for
some newbie sys admin.

Unfortunatly I don't see any way around this problem. Due to
the design of mod_perl, understanding the debuging the whole
system is nessisary. And before anyone says this is the
strength of open source software (of which I am an advocate)
most people are just trying to get something up and
running. They probably don't have the time or the expertice
to go looking through code to figure out what's going wrong.

===

the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu