Bug 51029 - Pipe test failures on Windows
Summary: Pipe test failures on Windows
Status: NEW
Alias: None
Product: APR
Classification: Unclassified
Component: APR (show other bugs)
Version: HEAD
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-06 06:36 UTC by Carlo Bramini
Modified: 2011-04-07 05:30 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlo Bramini 2011-04-06 06:36:40 UTC
The "make test" on MinGW+MSys generates a failure in testpipe.
The failure happens in wait_pipe() because apr_file_pipe_timeout_set() returns an error when trying to set the timeout.
By checking the code in APR, actually the timeout can be set only if the pipe has been open as overlapped object and when running at least on an NT platform.
Replacing:

rv = apr_file_pipe_create(&readp, &writep, p);

with:

rv = apr_file_pipe_create_ex(&readp, &writep, APR_FULL_NONBLOCK, p);

allowed to set the timeout correctly.
Unfortunately, the test still fails later because the next apr_file_pipe_wait() seems to return APR_ENOTIMPL.
Comment 1 William A. Rowe Jr. 2011-04-06 13:09:40 UTC
Ugh, are we building a Win9x flavor of APR out of mingw/msys?

I ask because that code was never maintained the best, and is definitely
suboptimal due to API restrictions!
Comment 2 Jeff Trawick 2011-04-06 14:20:07 UTC
the issue just seems to be the way that apr_file_pipe_create/_ex are written

there's no overlapped structure created unless apr_file_pipe_create_ex() was called, and told that at least one handle was non-blocking

without that happening, apr_file_pipe_timeout_set() refuses to support a non-zero timeout

Carlo's debug step to call 

rv = apr_file_pipe_create_ex(&readp, &writep, APR_FULL_NONBLOCK, p);

was proof that we aren't in the Win9x abyss
Comment 3 William A. Rowe Jr. 2011-04-06 14:34:21 UTC
That's right, now I'm remembering, this behavior is 'as expected', it wasn't
possible on win9x at all.  Thus the introduction of _ex(), so this 'behavior
is by design'.

In dropping support for win9x, it sure seems possible to normalize all of this
for rev 2.0 apr.
Comment 4 Carlo Bramini 2011-04-07 05:30:28 UTC
If I remember well... on Win9x and ME there are no problems to do asynchronous operations with communications devices (like serial ports), named pipes and mailslots, when they are opened with the FILE_FLAG_OVERLAPPED flag.
Compared to its successors, Windows 95 had also more restrictions than Windows 98 and ME because missing ReadFileEx/WriteFileEx functions, but it seems they are not used here.
I'm sure that these operating systems cannot do asynchronous disk accesses (with the only exception of ASPI), but I believe that the other resources should work fine.