And then change every instance of chan->scheduler_state = [...] to channel_set_scheduler_state([...]). Future hypothetical debugging sessions can be guaranteed to have information regarding what state each channel at all times.
Extra points if it logs some of the stuff in scheduler_bug_occurred too.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
In many places in the scheduling code we do (IDLE just used as an example)
chan->scheduler_state = SCHED_CHAN_IDLE;
I'm proposing we replace all these assignments to a channel's scheduler_state with a function that does it for us and logs the old and new state. It would most likely need to be defined in the "Private scheduler functions" section of scheduler.h in order to be reachable from all the scheduler source files.
In slightly better pseudocode, I propose the function looks like
scheduler_set_channel_state(chan, new_state){ log_debug(LD_SCHED, "chan %d changed from scheduler state %d to %d", chan->global_id, chan->scheduler_state, new_state); chan->scheduler_state = new_state;}
Ideally we would log "from state IDLE to WAITING_FOR_CELLS", which would call for a helper function if it doesn't already exist. And the int type on the channel's global ID needs to be correct, etc. etc.
The bonus points are for also logging the channel information that's logged in scheduler_bug_occurred like # of cmux cells and connection outbuf len.
(Note: bonus points aren't real, they just make dgoulet/pastly happy)