--- /dev/null
+ o Major bugfixes (scheduler):
+ If a channel is put into the scheduler's pending list, then it starts
+ closing, and then if the scheduler runs before it finishes closing, the
+ scheduler will get stuck trying to flush its cells while the lower layers
+ refuse to cooperate. Fix that race condition by given the scheduler an
+ escape method. Fixes bug 23676; bugfix on 0.3.2.1-alpha
if (flush_result > 0) {
update_socket_written(&socket_table, chan, flush_result *
(CELL_MAX_NETWORK_SIZE + TLS_PER_CELL_OVERHEAD));
+ } else {
+ /* XXX: This can happen because tor sometimes does flush in an
+ * opportunistic way cells from the circuit to the outbuf so the
+ * channel can end up here without having anything to flush nor needed
+ * to write to the kernel. Hopefully we'll fix that soon but for now
+ * we have to handle this case which happens kind of often. */
+ log_debug(LD_SCHED,
+ "We didn't flush anything on a chan that we think "
+ "can write and wants to write. The channel's state is '%s' "
+ "and in scheduler state %d. We're going to mark it as "
+ "waiting_for_cells (as that's most likely the issue) and "
+ "stop scheduling it this round.",
+ channel_state_to_string(chan->state),
+ chan->scheduler_state);
+ chan->scheduler_state = SCHED_CHAN_WAITING_FOR_CELLS;
+ continue;
}
- /* XXX What if we didn't flush? */
}
/* Decide what to do with the channel now */