Archived

This forum has been archived. Please start a new discussion on GitHub.

Unexpected connection exception

Hi,

I am using Ice 3.5.1 for C++, for Linux.

I have a problem in the implementaion of an operation in a server. When a client invokes that operation, the first invocation works well, but in the second one the client prints over the standard output:

warning: connection exception:
TransceiverI.cpp:721: Ice::ConnectionLostException:
connection lost: recv() returned zero

The log file in the server contains the following lines:

error: unexpected connection exception:
stc/Ice/Network.cpp:1057: Ice::SocketException:
socket exception: Bad file descriptor

After reviewing the source code of the server operation, I have realized that it closes the file descriptor 0 by mistake, by calling:
close (0);

If I remove that sentence, the problem above disappears.

My concern is now about understanding why this happens. As far as I Know, file descriptor 0 corresponds to the standard input. Thus, why is the connection exception thrown when the server closes file descriptor 0?

Kind regards,
Juan

Comments

  • benoit
    benoit Rennes, France

    Hi,

    The exception above indicates that the FD associated to a socket from an Ice connection was also un-expectedly closed. Are you sure your implementation isn't closing other FDs as well? I tried just closing the FD 0 with the hello world demo and I didn't get this issue.

    Cheers,
    Benoit.

  • Hi,

    my code just calls close(0), no more calls to close() are done.

    I forgot to indicate that I am using only SSL connections.

    Cheers,
    Juan

  • benoit
    benoit Rennes, France

    Hi,

    Can you reproduce the problem with a small test case based on one of our demos for example?

    Cheers,
    Benoit.