Giter Club home page Giter Club logo

Comments (3)

tmm1 avatar tmm1 commented on July 23, 2024

Ooh, this is very cool!

A fake stack frame for GC is a good idea. Please do submit a PR.

from stackprof.

jlfwong avatar jlfwong commented on July 23, 2024

Great! I'll look into it.

From a quick skim of the source, it's not clear to me why rb_postponed_job_register_one is used rather than just invoking stackprof_job_handler directly from stackprof_signal_handler.

From reading https://balazs.kutilovi.cz/post/ruby-tracing-part-two-rbtrace/, it sounds like postponed jobs are run when the process receives a signal, but isn't stackprof_signal_handler already only called due to a signal being received?

Is it necessary because otherwise the stack will include only the stackprof_signal_handler itself?

The only reason I ask is because I'm unsure whether I'd need to use rb_postponed_job_register_one to add the sample for the fake GC frame, or if I can do that synchronously within a function call from stackprof_job_handler.

from stackprof.

tmm1 avatar tmm1 commented on July 23, 2024

The issue that a signal can come in at any time, including for example when the Ruby VM is setting up a method call. It is not safe to get a ruby stack trace while the ruby stack itself is being manipulated and may be inconsistent. Doing so would quickly segfault the process.

Thus we use the postponed_job api to grab a stack trace as soon as the VM is consistent enough to do so.

For the GC case, I think you can just add the frame directly since you're only touching stackprof state and not doing anything with the VM.

from stackprof.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.