Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

BrowserUk, thank you! I appreciate your straightforward answers.

Sorry n'all, but that is garbage! Whilst you may have seen some symptoms like these and have attributed them to the use of signals; I'll bet that you cannot post code to demonstrate it.
This is a case of, as I believe, an inappropriate usage of signals, and the related symptoms of system degeneration. It is from
I am using:
  • Strawberry-perl-
  • Perl 5, version 12, subversion 2 (v5.12.2) built for MSWin32-x86-multi-thread
  • Windows 7 Home Premium with Service Pack 1

I have used version 1.11 and 1.12 of Test::TCP.

Problem: The test in Test::TCP is blocking. Get the system in state, that it must be restarted. It is sometimes not possible to kill the blocked processes. I even get errors like “Can't spawn "cmd.exe"” when using the system call. It indicates a degeneration of the perl interpreter.

One example of stochastic behavior (from is running this batch file:
@echo off set count=0 :loop set /a count=%count%+1 echo Count %count% @echo on perl -e "if ($pid=fork){Win32::Sleep(0); kill(9, $pid); Win32::Sleep(0 +)}else {sleep 1000}” if errorlevel 1 goto exit @echo off goto loop :exit ECHO.%ERRORLEVEL%

Examples of results I got was:

  • Blocking after 38 to 2806 loops.
  • Running more than 7000 loops.
  • Exiting with the value 9 after 1-7 loops.

This was done using Strawberry-perl- The patch removed most of the problem but not all. It was also found that version of the Windows operating system had different behavior.

As for the rest: Unix Signals are (one of several) "Unfixable designs". And most all the caveats and warnings you quoted from the MS docs for TerminateThread() are equally applicable to causing any piece of code to be interrupted without resumption using a longjump. Ie. Signals.

As an IPC mechanism, that only conveys 1 bit of information and is edge triggered -- ie. missable unless you happen to be ready for them -- signals are a piss poor substitute for proper IPC mechanisms.

And the need to use them to abandon in-progress processing is a sign of badly designed code. Describe the use case for using them and I'll outline a better way of tackling the problem. (Though it may or may not be currently available from Perl.)

I interpret your standpoint as:

  • Many implementations of signals are "unfixable". Not just the one in the implementation of Perl in Windows.
  • Signals are no proper IPC mechanisms.

Could you accept (or even recommend) the addition of something like this:

It is strongly advice against using signals for Inter Process Communication. This is particular important in Perl code intended to be portable.

to the Perl documentation? The addition could be done to the function kill in the Perl Language reference.

In reply to Re^2: Threads and signals in Windows by bojinlund
in thread Threads and signals in Windows by bojinlund

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (5)
    As of 2020-11-27 15:09 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found