Skip to content

openChannel can block forever on channel.getInputStream().peek() #154

Closed
@subdir

Description

@subdir

We want to be able to terminate our program early (e.g. on SIGTERM).

It was possible to some extent before this commit 8dd49eb

You could just call BinaryLogClient.disconnect() on program termination. If BinaryLogClient.channel is already set, then it disconnects, if not - no big deal (that being said, there were possible race conditions).

Now disconnect waits for connectLock which is released only after channel is created and at least one byte is successfully read. The problem is that in theory channel.peek() may block for indefinitely long time, so we have no way to shutdown gracefully.

Possible solution is to introduce connect timeout. It may be used not only with peek but with socket.connect as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions