Skip to content
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

Would atom table dumping be useful for recon? #56

Open
djnym opened this issue Apr 14, 2017 · 4 comments
Open

Would atom table dumping be useful for recon? #56

djnym opened this issue Apr 14, 2017 · 4 comments

Comments

@djnym
Copy link
Contributor

djnym commented Apr 14, 2017

See the second answer here
http://stackoverflow.com/questions/13480462/erlang-can-i-get-a-list-of-all-currently-registered-atoms
It's a neat trick which could of course break an any point, but I could imagine something which captured the current count, paused, then captured again helping out in the cases where you are programmatically creating atoms (or something is), and you don't know what.

Assumably, the system might first crash with full atom tables or something like that, they you start up with recon and see what's growing the table? At least that's a use-case I could imagine.

What do you think?

@djnym
Copy link
Contributor Author

djnym commented Apr 14, 2017

Actually someone at Klarna suggests trying this as well
https://engineering.klarna.com/monitoring-erlang-atoms-c1d6a741328e
(I'm clearing out old tabs and these were next to each other, I just sent them in the wrong order ;).
I'd be willing to make a pass at the code, but just wanted your opinion on it's usefulness before I do.

@ferd
Copy link
Owner

ferd commented Apr 14, 2017

I've never really seen the use too much for it, but it could make sense to allow this functionality.

If I had to build it though, I'd likely set it to return the N newest atoms in the table only (with maybe a type like pos_integer() | all so you can get the whole table, but you have to make it explicit). If you're noticing a leak, it's unlikely the atoms near the beginning of the table are to blame, given they'll be based on code and static, but those at the end of the table are all likely to be dynamic.

@djnym
Copy link
Contributor Author

djnym commented Apr 14, 2017

Yeah, I technically haven't needed it, but figured since I put recon onto all my systems if I ever did need it recon would be the place for it. I guess the real issue is finding the end of the table. With 20 one could use the atom_count stat, then use the external term format trick. For pre-20, the function from the klarna blog post could be used. I'll probably tinker with it and send along a PR at some point.

@ferd
Copy link
Owner

ferd commented Apr 14, 2017

An alternative approach would be to do the standard binary/exponential search:
1024,2048,4096,... until it fails, and then do binary search on the slice. Not sure if it would be faster than parsing the ~50kb or so of system info. Possibly slower, eh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants