Re: Trouble with perl fork() and exec()

2007-08-21 Thread George

Dave Korn wrote:

On 16 August 2007 16:31, George wrote:



I'm at a loss as to what could be holding up the python dll.  Is there
any advice for how to find this?


  Install Process Explorer from Sysinternals (now part of microsoft).  It
has a search function that lets you search all processes for any handles to
files (or other objects) of a given name.


Hi All,

Firstly, thanks for all the responses.

I've managed to track down the rebase problem and I've run it.  I'm 
still experiencing problems with a very slow fork() and detailed in the 
rest of the thread.


Can anybody suggest any other things I can try?

Cheers,

George

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Trouble with perl fork() and exec()

2007-08-16 Thread George

George wrote:

I have done that on the host in question.  It threw an error about a 
python dll:


$ ./rebaseall
ReBaseImage (/usr/lib/python2.4/site-packages/Numeric/arrayfns.dll) 
failed with last error =6


Hi,

I had a dig through the archives which suggest this error is caused by a 
still running process.  I took some time to make sure everything was 
stopped and then I've rerun the rebaseall command.


Unfortunately, this is still occuring.

I had a look in /proc/ :

$ cat /proc/*/exename
/usr/bin/ash.exe/usr/bin/cat.exe

I'm at a loss as to what could be holding up the python dll.  Is there 
any advice for how to find this?


Thanks in advance,

George

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



RE: Trouble with perl fork() and exec()

2007-08-16 Thread Dave Korn
On 16 August 2007 16:31, George wrote:


 I'm at a loss as to what could be holding up the python dll.  Is there
 any advice for how to find this?

  Install Process Explorer from Sysinternals (now part of microsoft).  It
has a search function that lets you search all processes for any handles to
files (or other objects) of a given name.


cheers,
  DaveK
-- 
Can't think of a witty .sigline today


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Trouble with perl fork() and exec()

2007-08-15 Thread George

Hello,

I have a cygwin installation under which I'm running the 
Net::Server::Fork daemon munin-node.  For those not aware, munin is a 
monitoring system which is really easy to use and configure 
(http://munin.projects.linpro.no).


That said, it's not working properly.

Here's the trouble I'm having - maybe somebody has seen it before and 
can push me in the right direction?


The basic flow of the daemon is:

start munin-node which attaches to a port and runs fine
connect from other machine1
machine1 request plugin
server forks() and then exec() the 'plugin' to gather data
plugin returns data to parent via STDIN
plugin exits
parent returns data to machine1
sing songs, drink beer

Now, this is breaking unfortunately, so I never get to sing songs and 
drink beer.


What seems to happen is the child gets fork()ed and then the plugin code 
exec()'d.  The data then comes back up the line via the STDIN to the 
parent, however, despite the child finishing execution (I've made sure 
all sockets are closed and even tried a die()) it never exits.


I've made the sure the data is actually coming back by putting a print 
in the while loop and that shows that it's coming back from the child. 
All the data makes it back, but the while loop doesn't finish and the 
timeout alarm hits, so the child gets reaped.  When it's reaped it 
returns Interrupted system call.


Ive tried replacing the exec() with a dirty hack of system();exit(); but 
exactly the same thing happens.


The relevant code which does the running of the plugin is below:

(Full code: 
http://munin.projects.linpro.no/browser/branches/1.2-stable/node/munin-node.in)



..
print # Forking .. \n if $DEBUG;
if ($child = open (CHILD, -|)) {
  eval {
  local $SIG{ALRM} = sub { $timed_out=1; die $!\n};
  alarm($timeout);
  while(CHILD) {
#last if $_ eq # DONE;
if ($_ eq # DONE) { close(CHILD); }
push @lines,$_;
print #DEBUG CHILD: $_ if $DEBUG;
  }
  print # Finished gathering data from Child\n if $DEBUG;
  };
  if( $timed_out ) {
  print # Child timed out - calling reap_children $@ \n if 
$DEBUG;

  reap_children($child, $service $command: $@);
  close (CHILD);
  return ();
  }
  unless (close CHILD)
  {
  if ($!)
  {
  # If Net::Server::Fork is currently taking care of reaping,
  # we get false errors. Filter them out.
  unless (defined $autoreap and $autoreap)
  {
  logger (Error while executing plugin \$service\: $!);
  }
  }
  else
  {
  logger (Plugin \$service\ exited with status $?. 
[EMAIL PROTECTED]);

  }
  }
else {
  if ($child == 0) {
my $timenow = localtime();
print # Child forked as $$ - $timenow\n if $DEBUG;
# New process group...
POSIX::setsid();

..
child stuff here
..

print # Execing $servicedir/$service $command\n if $DEBUG;
exec ($servicedir/$service, $command);

..

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Trouble with perl fork() and exec()

2007-08-15 Thread George

I've just found something in an strace:

**^M
Program name: C:\cygwin\bin\perl.exe (windows pid 5936)^M
App version:  1005.24, api: 0.156^M
DLL version:  1005.24, api: 0.156^M
DLL build:2007-01-31 10:57^M
OS version:   Windows NT-5.2^M
Date/Time:2007-08-15 18:04:46^M
**^M
  114 376 [main] perl (5936) child_copy: cygheap - hp 0x67C low 
0x611668E0, high 0x6116BBF8, res 1^M

   47 423 [main] perl (5936) child_copy: done^M
   70 493 [main] perl (5936) open_shared: name (null), n 4, shared 
0x6000 (wanted 0x6000), h 0xEC^M
   99 592 [main] perl (5936) heap_init: heap base 0x1041, heap 
top 0x1076^M
   62 654 [main] perl (5936) open_shared: name (null), n 1, shared 
0x6001 (wanted 0x6001), h 0xF0^M
   43 697 [main] perl (5936) user_shared_initialize: opening user 
shared for '' at 0x6001^M
   44 741 [main] perl (5936) user_shared_initialize: user shared 
version B1D50001^M
   58 799 [main] perl (5936) open_shared: name (null), n 2, shared 
0x6004 (wanted 0x6004), h 0xF4^M
  186 985 [main] perl (5936) open_shared: name 
Global\cygwin1S4.cygpid.5936, n 5936, shared 0x6003 (wanted 
0x6003), h 0x768^M

   541039 [main] perl 5936 set_myself: myself-dwProcessId 5936^M
   841123 [main] perl 5936 child_copy: dll data - hp 0x67C low 
0x6110, high 0x61104BA0, res 1^M
12277544 12278667 [main] perl 5936 child_copy: dll bss - hp 0x67C low 
0x6113F000, high 0x611483D0, res 1^M
 6188 12284855 [main] perl 5936 child_copy: user heap - hp 0x67C low 
0x1041, high 0x1076, res 1^M

   92 12284947 [main] perl 5936 child_copy: done^M
  108 12285055 [main] perl 5936 child_copy: data - hp 0x67C low 
0x408000, high 0x408010, res 1^M
   98 12285153 [main] perl 5936 child_copy: bss - hp 0x67C low 
0x40A000, high 0x40A0F0, res 1^M

   56 12285209 [main] perl 5936 child_copy: done^M

It would seem the dll bss copy is taking 12 seconds.

The machine running this is a quad xeon with 16Gb ram so it shouldn't 
have any issue with power (cpu is very low).  Can I give any data to 
help debug this?


George wrote:

Hello,

I have a cygwin installation under which I'm running the 
Net::Server::Fork daemon munin-node.  For those not aware, munin is a 
monitoring system which is really easy to use and configure 
(http://munin.projects.linpro.no).


That said, it's not working properly.

Here's the trouble I'm having - maybe somebody has seen it before and 
can push me in the right direction?


The basic flow of the daemon is:

start munin-node which attaches to a port and runs fine
connect from other machine1
machine1 request plugin
server forks() and then exec() the 'plugin' to gather data
plugin returns data to parent via STDIN
plugin exits
parent returns data to machine1
sing songs, drink beer

Now, this is breaking unfortunately, so I never get to sing songs and 
drink beer.


What seems to happen is the child gets fork()ed and then the plugin code 
exec()'d.  The data then comes back up the line via the STDIN to the 
parent, however, despite the child finishing execution (I've made sure 
all sockets are closed and even tried a die()) it never exits.


I've made the sure the data is actually coming back by putting a print 
in the while loop and that shows that it's coming back from the child. 
All the data makes it back, but the while loop doesn't finish and the 
timeout alarm hits, so the child gets reaped.  When it's reaped it 
returns Interrupted system call.


Ive tried replacing the exec() with a dirty hack of system();exit(); but 
exactly the same thing happens.


The relevant code which does the running of the plugin is below:

(Full code: 
http://munin.projects.linpro.no/browser/branches/1.2-stable/node/munin-node.in) 




..
print # Forking .. \n if $DEBUG;
if ($child = open (CHILD, -|)) {
  eval {
  local $SIG{ALRM} = sub { $timed_out=1; die $!\n};
  alarm($timeout);
  while(CHILD) {
#last if $_ eq # DONE;
if ($_ eq # DONE) { close(CHILD); }
push @lines,$_;
print #DEBUG CHILD: $_ if $DEBUG;
  }
  print # Finished gathering data from Child\n if $DEBUG;
  };
  if( $timed_out ) {
  print # Child timed out - calling reap_children $@ \n if 
$DEBUG;

  reap_children($child, $service $command: $@);
  close (CHILD);
  return ();
  }
  unless (close CHILD)
  {
  if ($!)
  {
  # If Net::Server::Fork is currently taking care of reaping,
  # we get false errors. Filter them out.
  unless (defined $autoreap and $autoreap)
  {
  logger (Error while executing plugin \$service\: $!);
  }
  }
  else
  {
  logger (Plugin \$service\ exited with status $?. 
[EMAIL PROTECTED]);

  

Re: Trouble with perl fork() and exec()

2007-08-15 Thread Reini Urban

George schrieb:

 I have a cygwin installation under which I'm running the
 Net::Server::Fork daemon munin-node.  For those not aware, munin is
 a monitoring system which is really easy to use and configure
 (http://munin.projects.linpro.no).

 That said, it's not working properly.

Did it work ok with a previous perl version?


   541039 [main] perl 5936 set_myself: myself-dwProcessId 5936^M
   841123 [main] perl 5936 child_copy: dll data - hp 0x67C low 
0x6110, high 0x61104BA0, res 1^M
12277544 12278667 [main] perl 5936 child_copy: dll bss - hp 0x67C low 
0x6113F000, high 0x611483D0, res 1^M


It would seem the dll bss copy is taking 12 seconds.


Did you try a rebaseall?

--
Reini

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Trouble with perl fork() and exec()

2007-08-15 Thread George

Reini Urban wrote:

George schrieb:

  I have a cygwin installation under which I'm running the
  Net::Server::Fork daemon munin-node.  For those not aware, munin is
  a monitoring system which is really easy to use and configure
  (http://munin.projects.linpro.no).

  That said, it's not working properly.

Did it work ok with a previous perl version?


It works fine on it's unix counterpart.  Also, if I load a plugin that's 
not a perl script but rather say a shell script it's fine eg: if I grab 
disk usage using `df` as parsed by a shell script, it never breaks.




   541039 [main] perl 5936 set_myself: myself-dwProcessId 5936^M
   841123 [main] perl 5936 child_copy: dll data - hp 0x67C low 
0x6110, high 0x61104BA0, res 1^M
12277544 12278667 [main] perl 5936 child_copy: dll bss - hp 0x67C low 
0x6113F000, high 0x611483D0, res 1^M


It would seem the dll bss copy is taking 12 seconds.


Did you try a rebaseall?


I have done that on the host in question.  It threw an error about a 
python dll:


$ ./rebaseall
ReBaseImage (/usr/lib/python2.4/site-packages/Numeric/arrayfns.dll) 
failed with last error =6



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/