-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: file descriptor leak detection for Gomega? #545
Comments
Nota bene: found two file descriptor leaks in my lxkns production code using Oh, and |
oh snap this is super impressive! I'm on a Mac so haven't been able to play with it but would love to pul lit in/include it (or, at minimum, update the README to point people at it if it would be easier to maintain as a standalone library). this sure would have saved a ton of time in an earlier life of mine. one suggestion - what might it look like to inspect the fds for a process launched by a test suite. one context I've seen problems with leaky fds come up is when some process under (integration) test misbehaves. it could be valuable to do something like:
|
@onsi now that's a can of worms of its own and a fun to ask here with you and others carrying the initial idea much farther! Since you started the new process under the same UID/GID and didn't something special the file descriptor information of that started process would be accessible. Somewhere the session should give me the PID and then it's the same (on Linux) regardless of looking at my own process using the I'm open to also integrating as we did with I have no macos at hand but I've seen |
make sense - sounds like something that could happen in a future iteration if there's demand for it. The
Sounds good. How about a PR to update the README and the
I think |
As for the README how do you would like it? Very short new |
@onsi what would you prefer for
|
IMP it should return |
No, just wanted to make sure that I'm getting this right. Thank you very much! One thing that I noticed already when leak-testing another go-based target: make sure to get the "good fd set" only after Go's stdlib netpoll has created the eventpoll fd as well as an internal pipe to break out of epoll_waits... Unfortunately, there's no reliable way to automatically filter these out as we don't have the information which code created a particular fd. That would require hardcore tools, such as kernel eBPF (sich!) hooks into certain syscalls... |
Now for the hard question: which package name to use when integrating the fd leak detection into Gomega? Based on urban dict results I doubt |
@onsi ping ... what would your suggestion as to the package name for the fd leak testing package? |
sorry I've been so behind! A boring and unpronounceable idea is I kinda like |
|
After the experimental new
gleak
package I took on file descriptor leak checking. I would like to ask for feedback (and maybe interest) in my fdooze module ... like withnoleak
/gleak
I'm open to integrating it into Gomega, if requested.Usually, it should boil down to this:
File descriptors are very OS specific and
fdooze
is Linux-only, because that is what according to the most recent Go survey more than 90% of Go developers use. There are other inconveniences when it comes to fd's compared with goroutines: no real identity and fd number get recycled as soon as possible. Also, you never know who was opening the fd (but then, this might be deep inside some 3rd party package anyway).To help finding the source of a leaked fd,
fdooze
dumps well-known flags and options with their symbolic constant names, wherever possible. Sockets are dumped with their addresses (hopefully) more usefully formatted, etc.As I said: feedback and suggestions highly welcome!
Oh, this time the mascot is "Goigi", the (young) file descriptor plumber.
And about the naming: maybe
gooze
instead, but that's a real brain twister?The text was updated successfully, but these errors were encountered: