Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: pipe fork win32

by bulk88 (Priest)
on Aug 26, 2012 at 02:23 UTC ( [id://989771]=note: print w/replies, xml ) Need Help??


in reply to Re: pipe fork win32
in thread pipe fork win32

If I change 373 in "print $parent "exit now\r\n\r" x 373;" to 745 (744 hangs) it works.
C:\Documents and Settings\Owner\Desktop>perl -e "print (length(\"exit +now\r\n\r\ " x 745).\"\n\");" 8195
I guess is somewhat explained by the hung C callstack of the child of my first script.
ntdll.dll!_KiFastSystemCallRet@0() ntdll.dll!_NtReadFile@36() + 0xc kernel32.dll!_ReadFile@20() + 0x67 > msvcr71.dll!_read_lk(int fh=3, void * buf=0x00963fec, unsigned in +t cnt=8192) Line 154 + 0x15 C msvcr71.dll!_read(int fh=3, void * buf=0x00963fec, unsigned int c +nt=8192) Line 75 + 0xc C perl517.dll!win32_read(int fd=3, void * buf=0x00963fec, unsigned +int cnt=8192) Line 3209 + 0x12 C perl517.dll!PerlLIORead(IPerlLIO * piPerl=0x00346654, int handle= +3, void * buffer=0x00963fec, unsigned int count=8192) Line 1033 + 0x +11 C++ perl517.dll!PerlIOUnix_read(interpreter * my_perl=0x0093502c, _Pe +rlIO * * f=0x00935e8c, void * vbuf=0x00963fec, unsigned int count=819 +2) Line 2789 + 0x22 C perl517.dll!Perl_PerlIO_read(interpreter * my_perl=0x0093502c, _P +erlIO * * f=0x00935e8c, void * vbuf=0x00963fec, unsigned int count=81 +92) Line 1679 + 0x3e C perl517.dll!PerlIOBuf_fill(interpreter * my_perl=0x0093502c, _Per +lIO * * f=0x00935aa4) Line 4033 + 0x1b C perl517.dll!Perl_PerlIO_fill(interpreter * my_perl=0x0093502c, _P +erlIO * * f=0x00935aa4) Line 1776 + 0x36 C perl517.dll!PerlIOBase_read(interpreter * my_perl=0x0093502c, _Pe +rlIO * * f=0x00935aa4, void * vbuf=0x0095b49c, unsigned int count=1) + Line 2170 + 0xd C perl517.dll!PerlIOBuf_read(interpreter * my_perl=0x0093502c, _Per +lIO * * f=0x00935aa4, void * vbuf=0x0095b49c, unsigned int count=1) +Line 4054 + 0x15 C perl517.dll!Perl_PerlIO_read(interpreter * my_perl=0x0093502c, _P +erlIO * * f=0x00935aa4, void * vbuf=0x0095b49c, unsigned int count=1) + Line 1679 + 0x3e C perl517.dll!Perl_pp_sysread(interpreter * my_perl=0x0093502c) Li +ne 1775 + 0x18 C perl517.dll!Perl_runops_debug(interpreter * my_perl=0x0093502c) +Line 2126 + 0xd C perl517.dll!win32_start_child(void * arg=0x0093502c) Line 1742 + + 0xd C++ kernel32.dll!_BaseThreadStart@8() + 0x37
0x2000/8192 was passed as the read amount to ReadFile. Does anyone know what should have happened on Windows? What happens on Unix? 8192 read also? or it will still succeed for POSIX reasons? is the 8192 read length a bug or correct?

Replies are listed 'Best First'.
Re^3: pipe fork win32
by BrowserUk (Patriarch) on Aug 26, 2012 at 03:30 UTC
    If I change 373 in "print $parent "exit now\r\n\r" x 373;" to 745 (744 hangs) it works.

    Hm. I used 373 because that is the lowest value on my system that worked (373 * 11 > 4096), so my system (Vista64) is using a 4096 byte buffer.

    I thought all Windows systems used that size. I wonder why yours is using 8k? What version of windows are you running? Are you using a home-built version of Perl? Did you tweak the value?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

        See http://www.nntp.perl.org/group/perl.perl5.porters/2011/02/msg169265.html for the change which apparently came in for 5.14.

        As the author notes 8k is an arbitrary figure. (And arbitrary is always stupid.)

        On every system I've checked -- including various flavours of Windows, one Linux and 1 BSD -- the optimal buffer size for disk IO is 16k or 64k.

        But for pipes and sockets, 4k is already too big for many purposes.

        I guess the best solution would be to expose setvbuf().


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        RIP Neil Armstrong

        It's 4k on perl5.8.9, perl10.1, and 8k on perl5.14.2.

        Looks like p5p decided to change it in PerlIO for some stupid reason.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        RIP Neil Armstrong

      For performance reasons, Perl's buffer was changed from 4K to 8K in 5.14.0. It was also made configurable at build time at the same time.

        Yes

        Unfortunately, it means it is now sub-optimal for all purposes. Too small for best throughput on block IO devices, and too big for streaming and communications.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        RIP Neil Armstrong

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://989771]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-03-19 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found