[Bug 33656] New: NamedPipe datagrams need to be _really_ datagrams

wine-bugs at winehq.org wine-bugs at winehq.org
Sat May 25 15:13:33 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=33656

             Bug #: 33656
           Summary: NamedPipe datagrams need to be _really_ datagrams
           Product: Wine
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: -unknown
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: joe_rocks at hotmail.com
                CC: adam.r.martinson at gmail.com, adys.wh at gmail.com,
                    asb at asbradbury.org, berillions at gmail.com,
                    dank at kegel.com, davilando at gmail.com,
                    djelinski1 at gmail.com, ernst at planetcoms.co.za,
                    euug3576+winebugs at gmail.com, focht at gmx.net,
                    grinnz at gmail.com, jjmckenzie51 at gmail.com,
                    jonnybarnes at gmail.com, knaprigt at gmail.com,
                    kyle.devir at gmx.com, lkcl at lkcl.net,
                    l_bratch at yahoo.co.uk, m.b.lankhorst at gmail.com,
                    mooroon2 at mail.ru, napoliste at gmail.com,
                    rmlipman at gmail.com, saulius2 at gmail.com,
                    surfing86 at live.it, techtonik at gmail.com,
                    trilavia at gmail.com, update.microsoft at mail.ru,
                    valentyn.pavliuchenko at gmail.com, vegarh at gmail.com
    Classification: Unclassified


+++ This bug was initially created as a clone of Bug #17195 +++

ok, after a little bit of investigation, i think i understand the pipes code
enough to be able to say what's going on, and i'm seeing something like this:

process 1:

recvpipe = CreateNamedPipe("\\pipe\fred")
ReadFile(recvpipe, buffer, &length);
printf(length) ===> 43
ReadPipe(recvpipe, buffer, &length); /* no data */

process 2:

sendpipe = CreateNamedPipe("\\pipe\fred")
length = 9;
WriteFile(sendpipe, buffer, &length);
length = 34;
WriteFile(sendpipe, buffer, &length);


what's happening is that the data being sent down the pipes isn't being done as
datagrams.  the implementation is using a stream-based fd.

the solution is: you _must_ implement a protocol on top of the pipes which
sends the length (as a 32-bit int, whatever) which is read off the fd, followed
by the data stream of _exactly_ that length.

_must_.  there's no two ways about this.

the protocol of Pipes is unfortunately a combination of both datagrams and
streams.  datagrams because the lengths of data sent are absolute and
inviolate.  streams because the data order and reliability are _also_ absolute
and inviolate.

you can't use datagrams (because they're unreliable).  you can't expect all
unixen to support datagrams on top of unix sockets (if that's what's being
used).

so - you have to send the length, as part of the implementation of the
pipe-data-send.

sending a length will also solve the issue of trying to send zero-length pipe
datagrams.

as a first implementation, you _might_ be able to get away with assuming that
when someone asks for some data, they _will_ provide a buffer big enough.

... actually... i don't see any ERR_MORE_DATA error codes in NtReadFile, so
that would explain... this is going to get messy :)

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list