Merged
Conversation
Contributor
Author
|
cc @mehrdada |
|
|
|
Contributor
|
@y-zeng if this PR is not yet merged on master, why not make this PR the primary one and get it upmerged alongside the rest of 1.9.x instead of having two PRs on master and 1.9.x? |
Contributor
Author
Contributor
|
@y-zeng Feel free to do whatever it is easier for you. I just thought upmerge is better because I imagined it would be easier for you, but whatever you feel is fine with me. Makes no difference. |
|
|
|
Contributor
|
Friendly ping: are we ready to merge this? |
sreecha
approved these changes
Jan 23, 2018
sreecha
reviewed
Jan 23, 2018
| | MAX_IDLE_STATE_SEEN_ENTER_IDLE | set, invalid | idle | | ||
| +--------------------------------+----------------+---------+ | ||
|
|
||
| MAX_IDLE_STATE_INIT: The initial and final state of 'idle_state'. The |
Contributor
There was a problem hiding this comment.
Thanks for the very detailed comments!!
Contributor
Author
|
|
|
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous implementation is faulty:
Assume we have one active call.
decrease_call_countwill be invoked,gpr_atm_full_fetch_adddecreasescall_countfrom 1 to 0.increase_call_countis called,gpr_atm_full_fetch_addsees thatcall_countis 0. It then cancels the timer.decrease_call_countthen continues its operation, and usesgrpc_timer_initto set up the timer.After these operations, there is still an active call, but the
max_idle timeris set. At the time this remaining call ends, it will cause the crash reported in #12257.The new implementation does not cancel
max_idle_timer(unless the channel is shutting down). Instead, it usesidle_stateto record ifmax_idle_timeris still valid. If the timer callback is called when themax_idle_timeris valid (i.e.idle_stateisMAX_IDLE_STATE_TIMER_SET), the channel will be closed due to idleness, otherwise the channel won't be changed.