Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
As it turns out, it wasn't the inherit bit (as tye suggested) or a child-inheritance problem at all. Win32 by default won't let processes created with ProcessCreate() inherit sockets in a straightforward way, they have to be passed externally through other means.

Through suggestions given by others reading this node, I tried isolating exactly when the sockets started getting ignored. So I tried POD'ing out all of the shutdown routines. And it was this bit of code here near line 244 in testcase.pl:

close($writer); print LOG "Deleting finished $writer\n" if $debug; delete $pool{"$writer"}; $pool_sel->remove($writer);
IO::Select->remove() on an already-closed descriptor seems to alter another descriptor in unknown ways. So it turns out that the file descriptor being affected by remove and the one being closed in the above example *aren't* the same descriptor. The simple fix is:
$pool_sel->remove($writer); close($writer); print LOG "Deleting finished $writer\n" if $debug; delete $pool{"$writer"};
Which solves the problem nicely. The earlier opened descriptors stay open like they should.

I'm unclear as to whether that's a bug in Perl or IO::Select. There are open bugs in Win32 Perl having to do with file descriptor mixups during process creation, so I wouldn't doubt that this might also be another one.


In reply to Re: Win32::Process::Create and IO::Select bad interaction by clintp
in thread Win32::Process::Create and IO::Select bad interaction by clintp

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-03-29 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found