cyrusimap / cassandane

Other
6 stars 11 forks source link

'cassandane smtpd' processes don't exit when cassandane(?) crashes #72

Open elliefm opened 5 years ago

elliefm commented 5 years ago

I mostly notice this when /dev/shm/cass fills up (with old logs) and then Cassandane crashes. Afterwards, I have to killall 'cassandane smtpd' to tidy up, otherwise future test runs get sporadic errors due to port numbers already being in use.

Interestingly, the other processes Cassandane starts up (all the cyrus masters, the fake notifyd, etc) seem to be tidied up correctly on this sort of failure. Not sure what the difference is, haven't looked, just throwing this up here so it's recorded somewhere.

elliefm commented 3 years ago

This might be because the thing that we fork is itself a forking server...

Relatedly, I think we need to rip this out of Instance.pm and into its own file (like utils/fakeldapd and utils/fakesaslauthd), and either hook it up to be started by master (like those two), or fork/exec it properly. As it currently stands, we end up deep in some subclass of Net::Server but with the running test's entire memory space still mapped, too. If the child process exits via anything but POSIX::_exit (which it does, and we can't control), it goes and calls all the test's destructors, leaving a mess behind for nontrivial tests...

I have a nasty little workaround in Instance.pm that will make its destructor bail out if the calling pid is the wrong one, but that still only protects the Instances, not anything else...