Skip to content

tcp plugin hang when using blocking file descriptor #42

@carns

Description

@carns

I've encountered a CCI hang (when used with Mercury) in which the ctp_tcp plugin blocks on read() within ctp_tcp_get_event() when trying to drain the pipe.

If I understand the desired behavior correctly, we want to drain the pipe if the event queue is empty at this point. I think the safest way to do this is to make the read fd for the pipe nonblocking by doing something like this:

fcntl(tep->pipe[0], F_SETFL, O_NONBLOCK);

... after the pipe is created to make sure that there is no danger of a drain attempt blocking. Then change the draining logic to run the do/while loop as long as the read() result == sizeof(a) instead of != sizeof(a);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions