Open bap2pecs opened 4 months ago
today we found it's due to code like this:
func fatal(err error) {
fmt.Fprintf(os.Stderr, "[fpd] %v\n", err)
os.Exit(1)
}
so when os.Exit()
is called, the process will terminate immediately without running deferred functions. This is because os.Exit does not allow the current function to return, bypassing the defer mechanism.
so code like these are not executed:
func (ctm *OpL2ConsumerTestManager) Stop(t *testing.T) {
var err error
err = ctm.FpApp.Stop()
require.NoError(t, err)
err = ctm.BabylonHandler.Stop()
require.NoError(t, err)
ctm.EOTSServerHandler.Stop()
}
thus leaving some processes dangling
cc @SebastianElvis
Yeah we are aware of this issue, and great work finding the root cause! Looks like we need a more graceful way to terminate the program compared to os.Exit(1)
this gave us lots of trouble when debugging a failed test
then we realized it's b/c there were some process running:
we found out the panic happened inside
we should have a better way to deal w it here