SPUG: unsupported %SIG in ActivePerl??

Marc M. Adkins Marc.M.Adkins at Doorways.org
Tue Apr 9 14:37:21 CDT 2002


Windows doesn't actually have all of the signals that UNIX does.  The
following signals are listed in the MSDN Library:

	signal 	Description
	--------------------------------
	SIGABRT	Abnormal termination
	SIGFPE	Floating-point error
	SIGILL	Illegal instruction
	SIGINT	CTRL+C signal
	SIGSEGV	Illegal storage access
	SIGTERM	Termination request

My experience with ActiveState Perl on Windows 2000 leads me to believe that
the rest of the signals that one would expect (including CHLD) don't ever
fire under Windows.  So they would have to be emulated somehow in Perl to
work at all.

Moreover there are some weird caveats even for the ones that _do_ exist.
Like I don't think you can raise them all, some of them can only be raised
by the operating system (or something like that).

>From the ActiveState documentation (under Windows Specifics/Quirks):

	Signals are unsupported by the Win32 API.  The C Runtime provides
	crude support for signals, but there are serious caveats, such as
	inability to die() or exit() from a signal handler.  Perl itself
	does not guarantee that signal handlers will not interrupt critical
	operations such as memory allocation, which means signal invocation
	may throw perl internals into disarray.  For these reasons, signals
	are unsupported at this time.

So in general, it isn't wise to depend upon signals in code that has to run
on Windows.  Better to find some other mechanism to achieve the same goal.

Marc M. Adkins
MMADKI at Doorways.org

P.S.  I just submitted a resume to admin at veruslaw.com...is that you guys?

> -----Original Message-----
> From: owner-spug-list at pm.org [mailto:owner-spug-list at pm.org]On Behalf Of
> Chris Petersen
> Sent: Tuesday, April 09, 2002 11:02 AM
> To: spug-list at pm.org
> Subject: SPUG: unsupported %SIG in ActivePerl??
>
>
> Hi, on the advice of a coworker, I signed up for the spug-list..
> hopefully someone here can help me out with a particular problem I'm
> having with ActivePerl...
>
> Basically, I have a rather large collection of web robots (300+), and I've
> written a scheduler for them based on the pre-forking server model
> presented in the perl documentation (with a few modifications since that
> one doesn't work quite right under linux - and NOTHING works in
> windows).
> Most people in alt.perl.* just tell me not to use NT/2k (which is my
> opinion, too) but that's not really an option, and I'm hoping that someone
> here can help me out with a workaround.
>
> Sorry for the lack of re-editing, but it's a lot easier to just forward
> the message I sent to ActiveState than try to rewrite it - all of the
> information is the same.
>
> -Chris
>
> -----------------
>
> you list the standard perl IPC docs at:
>
> http://aspn.activestate.com/ASPN/Products/ActivePerl/lib/Pod/perlipc.html
>
> However, I've copied this code almost verbatim into a pre-forking server
> that I wrote (it works perfectly in linux and under cygwin)..  However, it
> never receives $SIG{CHLD} handlers when I run it in Windows (98, NT and
> 2000).  Again following the code you list, I ran:
>
> 	use Config;
>
> 	foreach $name (split(' ', $Config{sig_name})) {
> 		print "$name\n";
> 	}
>
>
> This resulted in a rather lengthy list of signal handlers,
> including CHLD.
> This tells me that NT should be supporting the signal properly.
>
> The pre-forking server is designed to run $Max forked processes (which
> basically "require" a subscript and then exit), and to fork off new ones
> when the old ones die off..  However, since $SIG{CHLD} is never received,
> it merely runs $Max scripts and then hangs, waiting for them to finish,
> even when the processes themselves consist entirely of something to the
> extent of:
>
> 	#!/usr/bin/perl
> 	print "test\n";
> 	exit;
>
> $SIG{INT} and other similar signals *do* work, so it's seemingly only the
> CHLD (and possibly other related) signal that doesn't.  I've tracked the
> memory usage of perl while the pre-forking server runs, and the
> block does
> grow appropriately for each instance of a forked process, and eventually
> deflates back down after a few seconds, as the subscripts finish (telling
> me that fork itself is working fine).
>
> I need to confirm with you that this is a bug in your software or
> a glitch
> in Windows (I'm pretty sure it's not my code since it's the same
> code that
> pops up all over the place in the perl IPC docs - includin the ones you
> publish on your site).  If it is a fixable error, do you have any idea
> when a working version of ActivePerl might be available?
>
> Thanks,
>
> Chris Petersen
> Programmer, VersusLaw Inc.
>
>
>
>
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>      POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
>       Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
>   Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
>  For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
>      Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
>
>


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org




More information about the spug-list mailing list