peterzhu2118 (Peter Zhu) wrote in #note-2: > Thank you for this ticket. I opened a PR that implements this feature: https://github.com/ruby/ruby/pull/10439 Thank you so much Peter! <3mk (Matthias Käppler)
`GC.stat` exposes a `heap_live_slots` metric that returns the number of live objects occupying eden slots. Because the slot size was fixed to `RVALUE_SIZE`, this allowed for some basic approximations of how many bytes were live/in-use...mk (Matthias Käppler)
I hope I summarized it correctly: https://gitlab.com/gitlab-org/ruby/gems/prometheus-client-mmap/-/issues/39 I'm not sure if your and my test case crash for precisely the same reason. If they do, then I am missing how unmap fits into ...mk (Matthias Käppler)
Thanks for sharing this; I still don't think this is related to the memory map going away. Not exclusively anyway. My original test case does not close or unmap the counter file, but it still crashes. The counter is still in scope when w...mk (Matthias Käppler)
@byroot I wonder if you could help me understand the underlying issue better. I found a minimal, executable test case that reproduces this issue reliably: ```ruby Prometheus::Client::MmapedValue.new(:counter, :counter, 'ordered_count...mk (Matthias Käppler)
Thank you, this helps a lot! I will test the patch you suggest and see if that addresses the immediate problem. If it does, I can take a stab at putting a PR together. I would credit you of course. Really appreciate your time spent on...mk (Matthias Käppler)
byroot (Jean Boussier) wrote in #note-15: > It's even worse than using `str_new_static`, it's creating a regular string and rewriting the pointer. This is terrible code. Yikes -- good catch! This library isn't particularly active o...mk (Matthias Käppler)
I'm not sure this makes sense but: we know the address being referenced is somewhere (half-way) into a memory region that is a memory-mapped file using that Prometheus library's binary encoding. This is the file: ``` xxd gauge_max...mk (Matthias Käppler)
It looks like I can't do anything useful with that address: ``` (gdb) p *0x7fced23f4000 Cannot access memory at address 0x7fced23f4000 ``` This is getting mysterious. I looked at process maps to see what kind of memory region th...mk (Matthias Käppler)
byroot (Jean Boussier) wrote in #note-5: > Also, based on the backtrace I believe that `ObjectSpace.each_object(String, &:valid_encoding?)` should cause the same crash. Indeed! ``` bundle exec rbtrace -p $(pgrep -f 'worker 1') -e...mk (Matthias Käppler)