Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Add 'finished' chan to stop callers blocking on closed connection #414

Merged
merged 1 commit into from
Feb 24, 2015

Conversation

bboreham
Copy link
Contributor

Addresses a source of deadlock in weave arising from LocalConnection's habit of exiting its queryLoop() routine while callers are trying to talk to it. After there are 16 messages in the channel, the sends block, and some of them can be from places where locks are held.

This PR introduces a second 'finished' channel, which is closed on exit from queryLoop(). All callers select on the 'finished' channel as well as the 'query' channel, and since a closed channel is always ready to read, they do not block.

This issue was found while investigating #411, but without stack traces I cannot be absolutely certain that this is the cause of that incident.

@rade
Copy link
Member

rade commented Feb 23, 2015

I think you want a sendQuery(code, payload) helper.

@bboreham bboreham force-pushed the 411_closed_connections branch from 93d9bd4 to 78d2a3e Compare February 24, 2015 10:49
@bboreham
Copy link
Contributor Author

Re-pushed with sendQuery() helper

@rade rade added the bug label Feb 24, 2015
rade added a commit that referenced this pull request Feb 24, 2015
Add 'finished' chan to stop callers blocking on closed connection
@rade rade merged commit b53a2c7 into weaveworks:master Feb 24, 2015
@rade rade removed the in progress label Feb 24, 2015
@rade rade modified the milestone: 0.10.0 Apr 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants