Fraser Adams created PROTON-569:
-----------------------------------

             Summary: Initialise pipe file descriptors to -1 in messenger prior 
to calling pn_pipe
                 Key: PROTON-569
                 URL: https://issues.apache.org/jira/browse/PROTON-569
             Project: Qpid Proton
          Issue Type: Bug
            Reporter: Fraser Adams
            Priority: Minor


In messenger the pipe file descriptors are not initialised prior to the call to 
pn_pipe. In most cases this isn't an issue as the call to pipe should do 
something, however there is no check made for pn_pipe failing and indeed the 
control pipe/interrupt stuff is essentially not an essential part of messenger 
so that is reasonable. The issue I've seen though is for the JavaScript 
bindings I'm working on, in emscripten the pipe call essentially does nothing 
and just returns -1, the problem however is that the uninitialised pipe file 
descriptors are zero, in other words m->ctrl[0] = 0, which is the 
filedescriptor for stdin!!!

I kept on getting PN_INTR errors until I worked out what was going on.

See also https://github.com/kripken/emscripten/issues/2313

Simply doing
    m->ctrl[0] = -1;
    m->ctrl[1] = -1;

before 
    pn_pipe(m->io, m->ctrl);

Makes things behave as expected.




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to