ergochat / ergo

A modern IRC server (daemon/ircd) written in Go.
https://ergo.chat/
MIT License
2.27k stars 180 forks source link

reattaching or resuming clients can receive protocol data before 001 RPL_WELCOME #772

Open slingamn opened 4 years ago

slingamn commented 4 years ago

Reattach and resume immediately attach your session to the preexisting client object. This means that the session is immediately "subscribed" to all channel events, including JOIN and PRIVMSG lines --- this can happen even before the registration burst (with RPL_WELCOME) is transmitted.

This race is going to be fairly common under certain circumstances (i restarted nginx, which resulted in a rapid succession of JOIN lines as people rejoined), and it crashed bitbot. This seems like something to avoid, although it's not immediately clear to me how to avoid it without performance degradation.

slingamn commented 4 years ago

The window in which this race can occur was increased by #694, which moved hostname lookup to the end of registration (between the reattach and the RPL_WELCOME). I think I can move this around slightly as a mitigation.

slingamn commented 4 years ago

This still exists, but shouldn't be too pressing (the critical period should be much shorter now).

slingamn commented 4 years ago

I'm not very worried about this anymore, so taking it out of the 2.1 milestone.