]> jfr.im git - solanum.git/commit
Delay rehashing until we're not processing events
authorEd Kellett <redacted>
Sun, 5 Nov 2023 22:05:41 +0000 (22:05 +0000)
committerStephen Bennett <redacted>
Mon, 6 Nov 2023 14:22:55 +0000 (14:22 +0000)
commit59ea3c6753e80d051b20223cb327294cac985afe
tree4170183ec4ef0af3c657fd952806409993bc81a5
parent460e7932744e7d48795875270a1a610a6a8dfa31
Delay rehashing until we're not processing events

Fixes crash introduced by 0ab6dbbc651ddd1c26cb7baa6e6cf86890a4abd2. It's
probably a regression since it defeats a system designed to stop this
from happening, but I didn't dig through the history.

rehash() closes listeners. If we happen to get a single epoll() result
that wants to first rehash and then accept a connection, the epoll info
will point to a freed rb_fde_t. Other selectors should have similar
problems, but we didn't investigate that.

rb_fde_ts are normally batched up and freed outside the event
processing, but as of the above commit close_listeners() screws that up
by closing pending FDs immediately in order to create new listeners.

I think it might be a bit better to revert this behaviour and simply not
close listeners if we are going to open new ones over them, but have
opted for the smallest reasonable change I can think of.

Helped-by: Eric Mertens <redacted>
ircd/s_conf.c
librb/include/rb_commio.h
librb/src/commio.c
librb/src/export-syms.txt