Skip to content

Conversation

@Shillaker
Copy link
Collaborator

@Shillaker Shillaker commented Jun 17, 2021

At the moment we don't set any timeouts in our use of 0MQ, which means we get an infinite hang if something goes wrong. Instead we would like things to time out, so this PR sets the send timeout and recv timeout on every 0MQ socket by default.

I actually can't work out in which scenario the send timeout would be triggered, hence there's no test for it and it could be overkill. However, for now I'd like to keep it in case it catches any of the issues we've been seeing.

@Shillaker Shillaker self-assigned this Jun 17, 2021
@Shillaker Shillaker marked this pull request as ready for review June 17, 2021 15:15
int recvTimeoutMs = DEFAULT_RECV_TIMEOUT_MS;
int sendTimeoutMs = DEFAULT_SEND_TIMEOUT_MS;

void validateTimeout(int value);
Copy link
Collaborator Author

@Shillaker Shillaker Jun 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These have to be protected because of the subclassing that goes on (otherwise they'd be private).


// Print default message and rethrow
SPDLOG_ERROR("Error receiving message: {} ({})", e.num(), e.what());
throw;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message was missing the error code before.

@Shillaker Shillaker requested a review from csegarragonz June 18, 2021 08:07
server.stop();
}

TEST_CASE("Test client timeout on requests to valid server", "[transport]")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the right place to put this test. It requires a custom server, but is really testing functionality in the client.

Copy link
Collaborator

@csegarragonz csegarragonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just one minor pint re. infinite timeouts.


void MessageEndpoint::validateTimeout(int value)
{
if (value <= 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So how would we specify an infinte timeout? Do we want to support that at all? I would expect a negative timeout to not timeout at all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not support infinite timeouts anywhere. I can't think of a case where it's justified.

@Shillaker Shillaker merged commit 12796a1 into master Jun 18, 2021
@Shillaker Shillaker deleted the endpoint-timeouts branch June 18, 2021 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants