Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MaxCloseTime as a graceful close timeout #724

Merged
merged 1 commit into from
Feb 1, 2019
Merged

Conversation

prashantv
Copy link
Contributor

Currently, a connection waits until all calls are complete before
moving to the "closed" state. However, if there are stuck calls
(either because of long-running user calls, or because of issues
where calls are not tracked properly), the connection can remain
open forever and leak resources.

Add a MaxCloseTime which will close the connection after spending
a maximum amount of time in a close state.

Rather than add another close branch, reuse the existing connection
error branch (by using read deadlines).

We now also ensure checkExchanges will move the connection to the closed
state once exchanges are closed -- important since relay calls are not
forcefully shutdown in closeNetwork, so we wouldn't actually change
state previously.

Fixes #699

@prashantv prashantv requested a review from witriew January 29, 2019 06:05
@codecov
Copy link

codecov bot commented Jan 29, 2019

Codecov Report

Merging #724 into dev will increase coverage by 0.68%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #724      +/-   ##
==========================================
+ Coverage   87.24%   87.92%   +0.68%     
==========================================
  Files          40       40              
  Lines        4068     4075       +7     
==========================================
+ Hits         3549     3583      +34     
+ Misses        395      374      -21     
+ Partials      124      118       -6
Impacted Files Coverage Δ
connection.go 84.1% <100%> (+0.77%) ⬆️
root_peer_list.go 92% <0%> (-4%) ⬇️
peer.go 94.54% <0%> (+0.72%) ⬆️
inbound.go 81.05% <0%> (+1.57%) ⬆️
channel.go 90% <0%> (+1.66%) ⬆️
outbound.go 89.08% <0%> (+2.87%) ⬆️
mex.go 77.2% <0%> (+5.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96feb7f...aad417b. Read the comment docs.

Currently, a connection waits until all calls are complete before
moving to the "closed" state. However, if there are stuck calls
(either because of long-running user calls, or because of issues
where calls are not tracked properly), the connection can remain
open forever and leak resources.

Add a MaxCloseTime which will close the connection after spending
a maximum amount of time in a close state.

Rather than add another close branch, reuse the existing connection
error branch (by using read deadlines).

We now also ensure checkExchanges will move the connection to the closed
state once exchanges are closed -- important since relay calls are not
forcefully shutdown in `closeNetwork`, so we wouldn't actually change
state previously.

Fixes #699
@prashantv prashantv merged commit 184b1be into dev Feb 1, 2019
@prashantv prashantv deleted the close_timeout branch February 1, 2019 20:59
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.

'connectionStartClose' state should eventually cause a force close
2 participants