Project

General

Profile

Actions

Feature #8263

open

Support discovering yield state of individual Fibers

Added by halorgium (Tim Carey-Smith) over 11 years ago. Updated almost 3 years ago.

Status:
Assigned
Target version:
-
[ruby-core:54249]

Description

Related to #8215, when debugging a multi-Fiber application or library it is useful to be able to look at the stack for the Thread which is possible right now.
Currently it is not possible to discover where the Fiber was yielded.

Is this something that could be added?

Thread.backtrace example

Updated by halorgium (Tim Carey-Smith) over 11 years ago

Should this be in common-ruby?
Could someone move it?

Actions #2

Updated by tmm1 (Aman Karmani) over 11 years ago

  • Project changed from Ruby master to 14

Updated by halorgium (Tim Carey-Smith) over 11 years ago

There was some confusion about what I am proposing.
I realised I didn't even explain this!

I would like to be able to see the backtrace of individual Fibers.
This would allow our Celluloid.stack_dump to show each point at which the Fibers are waiting.

Updated by halorgium (Tim Carey-Smith) over 11 years ago

I have implemented Fiber#backtrace in Rubinius and have a demo of what I wanted to achieve.

https://gist.github.com/halorgium/c770d3cf27f6279e5e43

This depends on another change, Thread#root_fiber, which returns the root_fiber of the specified Thread.

Updated by ko1 (Koichi Sasada) over 11 years ago

  • Assignee set to ko1 (Koichi Sasada)

Sorry, I can't understand what is your proposal.

At first example https://gist.github.com/halorgium/f63abf177a96d7113ce3,
there is only "thread.backtrace". However, we have already Thread#backtrace.

p Thread.current.backtrace
#=>
ruby 2.1.0dev (2013-03-18 trunk 39808) [i386-mswin32_100]
["t.rb:2:in backtrace'", "t.rb:2:in '"]


BTW, please add more specific description.

For example, Rdoc style description for proposed methods
is very welcome because we can understand your proposal
and we (especially I, who is not good English writer)
can copy this document to implemented source code!

Updated by halorgium (Tim Carey-Smith) over 11 years ago

When you have many Fibers inside a Thread.
You cannot find where the FIbers are currently suspended.

I propose adding a method to Fiber to return this information.

Calling Fiber.current.backtrace would be equivalent to Thread.current.backtrace due to the nature of Fibers.

Does this help with understanding?

Updated by ko1 (Koichi Sasada) over 7 years ago

  • Description updated (diff)

It seems nice.

Actions #8

Updated by shyouhei (Shyouhei Urabe) over 7 years ago

  • Status changed from Open to Assigned

Updated by googlefeud (google feud (spammer, locked)) over 6 years ago

  • Subject changed from Support discovering yield state of individual Fibers to google gravity

You can solve your issue by using anti google gravity underwater

Actions #10

Updated by usa (Usaku NAKAMURA) over 6 years ago

  • Subject changed from google gravity to Support discovering yield state of individual Fibers
Actions #11

Updated by hsbt (Hiroshi SHIBATA) almost 3 years ago

  • Project changed from 14 to Ruby master
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0