Hello mailinglist, i have a problem...
I wrote a mod_perl-script running on an Apache-Server which has
to receive a GIF-File from a NT-Server via a IO::Socket. (see code below)
On the NT-side there is a JAVA-programm.
Here some information about the used software:
(A) my workstation:
Linux 2.2.13
Apache/1.3.9 (Unix) (SuSE/Linux) PHP/3.0.12 mod_perl/1.21
perl, version 5.005_03
(B) production server:
Linux 2.2.7
Apache/1.3.6 (Unix) (SuSE/Linux) PHP/3.0.7 mod_perl/1.19
perl, version 5.005_02
(C) test-server:
Linux 2.2.5
Apache/1.3.4 (Unix) (SuSE/Linux) PHP/3.0.7 mod_perl/1.18
perl, version 5.005_02
I developed and tested the script on my workstation (A) and it worked.
Moving to the production server (B) or another test-server (C) the
mod_perl-script seems to crash without a sigh (C) or doesn´t receive
the whole file (B).
I have concentrated on the more severe problem (crashing on test-server C).
The script cycles through the while-loop receiving a packet, sends
a newline to the JAVA-program and writes to the IMG-Handle.
And then after some packets it dies, just before the handshaking newline.
The debugging output "GetFile: ready" does´nt appear in the logfile (GISLOG)
and the function does´nt return to the main program (No further output
in GISLOG)
There is no message in the apache error_log and also
standalone Perl in debugmode (perl -d ) gave up without any comment,
leaves me alone on the commandline.
And more confusing is:
The httpd child process does not die, according to the server status report.
Why dies perl in debug-mode when mod_perl survives it. At least i think so,
because as far as my knowledge goes mod_perl is a part of the httpd-process.
I would appreciate hints for further reading and/or tips how to debug this
problem.
The apache and linux versions are different on the three servers,
suggesting me to update. But i hope there is another solution for this problem.
Can someone point me in the right direction?
Many thanks in advance
Uli
part of geoServ.pl -------------------------------------------------------------
1 sub GetFile {
2 my ($remote_host, $filename,$remote_port)=@_;
3 my $i;
4 $i=0;
5 open(IMG,"> $htmlroot/$filename");
6 print $GISLOG "GetFile: trying $remote_host:$remote_port :\n";
7 $socket = IO::Socket::INET->new(PeerAddr => $remote_host,
8 PeerPort => $remote_port,
9 Proto => "tcp",
10 Timeout => 5,
11 Type => SOCK_STREAM)
12 or die "Couldnt connect to $remote_host:$remote_port : $@\n";
13 print $GISLOG "GetFile: connected $remote_host:$remote_port :\n";
14 $socket->autoflush(1);
15 if ($socket){ print "Connected<br>\n";}
16 $fSize= <$socket>;
17 print "fSize: $fSize XXX<br>\n";
18 print $socket "\n";
19 print $GISLOG "GetFile: receiving ";
20 print "GetFile: receiving .... ";
21 $sizeRead=0;
22 while(<$socket>){
23 print $GISLOG $i++." ";
24 print $socket "\n"; # ok, there on the other side
25 print IMG $_;
26 }
27 print $GISLOG "GetFile: ready ";
28 close($socket);
29 close(IMG);
30 }
-----------------------------------------------------------------------------
PS: The problem appears while redeveloping parts of a project
for the Digital Environmental Atlas of Berlin.
If You are interested, an entrypoint to see the older, working solution is for example:
http://www.sensut.berlin.de/sensut/umwelt/uisonline/dua96/html/ek102.ht