I re-ran my recreate scenario with the websocket fix and noticed that we still leaked a couple file handles. After some additional tracing, I see that we are missing a close for the API in the case where we fail to start some of the MachineAgent workers. We need to add a defer function to cmd/jujud/machine.go: APIWorker after a successful call to openAPIState that looks like this:
defer func() {
if err != nil { st.Close()
}
}()
I will add in these changes and re-run my tests overnight to see if any other file handles are leaked.
I re-ran my recreate scenario with the websocket fix and noticed that we still leaked a couple file handles. After some additional tracing, I see that we are missing a close for the API in the case where we fail to start some of the MachineAgent workers. We need to add a defer function to cmd/jujud/ machine. go: APIWorker after a successful call to openAPIState that looks like this:
defer func() {
st.Close( )
if err != nil {
}
}()
I will add in these changes and re-run my tests overnight to see if any other file handles are leaked.