sched: Set channel scheduler state to IDLE when not opened

In the KIST main loop, if the channel happens to be not opened, set its state
to IDLE so we can release it properly later on. Prior to this fix, the channel
was in PENDING state, removed from the channel pending list and then kept in
that state because it is not opened.

This bug was introduced in commit dcabf801e5 for
which we made the scheduler loop not consider unopened channel.

This has no consequences on tor except for an annoying but harmless BUG()
warning.

Fixes #24502

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet 2017-12-04 14:48:15 -05:00
parent a5be2305e1
commit 97702c69b0
2 changed files with 8 additions and 1 deletions

4
changes/bug24502 Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes (scheduler):
- Properly set the scheduler state of an unopened channel in the KIST
scheduler main loop. This prevents a harmless but annoying log warning.
Fixes bug 24502; bugfix on 0.3.2.4-alpha.

View File

@ -606,9 +606,12 @@ kist_scheduler_run(void)
* fails leading to the channel to be closed which triggers a release * fails leading to the channel to be closed which triggers a release
* and free its entry in the socket table. And because of a engineering * and free its entry in the socket table. And because of a engineering
* design issue, the error is not propagated back so we don't get an * design issue, the error is not propagated back so we don't get an
* error at this poin. So before we continue, make sure the channel is * error at this point. So before we continue, make sure the channel is
* open and if not just ignore it. See #23751. */ * open and if not just ignore it. See #23751. */
if (!CHANNEL_IS_OPEN(chan)) { if (!CHANNEL_IS_OPEN(chan)) {
/* Channel isn't open so we put it back in IDLE mode. It is either
* renegotiating its TLS session or about to be released. */
chan->scheduler_state = SCHED_CHAN_IDLE;
continue; continue;
} }
/* flush_result has the # cells flushed */ /* flush_result has the # cells flushed */