So it is likely that something inside Juju itself is clearly holding on to the File objects. (My personal guess is that we leak State objects as part of the workers restarting, but I wouldn't expect State objects to be holding onto the files that we are using for logging.)
We had an idea floated that Go might not be reaping file descriptors when the File objects were being garbage collected, but Arnaud specifically located the code in Go where it sets a finalizer. /cs.opensource. google/ go/go/+ /refs/tags/ go1.17. 3:src/os/ file_unix. go;l=187; drc=refs% 2Ftags% 2Fgo1.17. 3
https:/
And that has been true for quite some time: /cs.opensource. google/ go/go/+ /refs/tags/ go1.8:src/ os/file_ unix.go; l=57
https:/
So it is likely that something inside Juju itself is clearly holding on to the File objects. (My personal guess is that we leak State objects as part of the workers restarting, but I wouldn't expect State objects to be holding onto the files that we are using for logging.)