ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber
@ 2013-04-03 23:47 halorgium (Tim Carey-Smith)
  2013-04-04 12:50 ` [ruby-core:53990] [ruby-trunk - Feature #8215][Closed] " Eregon (Benoit Daloze)
                   ` (11 more replies)
  0 siblings, 12 replies; 14+ messages in thread
From: halorgium (Tim Carey-Smith) @ 2013-04-03 23:47 UTC (permalink / raw)
  To: ruby-core


Issue #8215 has been reported by halorgium (Tim Carey-Smith).

----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215

Author: halorgium (Tim Carey-Smith)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

Thread.current[:key] = "outside"
fiber = Fiber.new do
  Thread.current[:key] = "inside"
  Fiber.yield
end
fiber.resume
fiber[:key] == "inside" # true
fiber.backtrace # ...

I also wonder whether Fiber#[] should be implemented, so Fiber.current[:key] is possible.

For reference, here is the issue on the rubinius issue tracker: https://github.com/rubinius/rubinius/issues/2200


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:53990] [ruby-trunk - Feature #8215][Closed] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
@ 2013-04-04 12:50 ` Eregon (Benoit Daloze)
  2013-04-05  9:27 ` [ruby-core:54019] [ruby-trunk - Feature #8215][Open] " nobu (Nobuyoshi Nakada)
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Eregon (Benoit Daloze) @ 2013-04-04 12:50 UTC (permalink / raw)
  To: ruby-core


Issue #8215 has been updated by Eregon (Benoit Daloze).

Category set to core
Status changed from Open to Closed

Thread#[] and friends access *Fiber*-local variables, as the doc says:

(Attribute Reference---Returns the value of a fiber-local variable (current
thread's root fiber if not explicitely inside a Fiber), using either a symbol
or a string name.)

This is unfortunate, as indeed one might expect it to be *thread*-local,
but it has been made fiber-local for safety.

In ruby >= 2.0.0, you have thread_variable_{get,set} and such for manipulating *thread*-local variables.
Not as nice, but at least the API is there. See #7097.
----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-38215

Author: halorgium (Tim Carey-Smith)
Status: Closed
Priority: Normal
Assignee: 
Category: core
Target version: 


As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

Thread.current[:key] = "outside"
fiber = Fiber.new do
  Thread.current[:key] = "inside"
  Fiber.yield
end
fiber.resume
fiber[:key] == "inside" # true
fiber.backtrace # ...

I also wonder whether Fiber#[] should be implemented, so Fiber.current[:key] is possible.

For reference, here is the issue on the rubinius issue tracker: https://github.com/rubinius/rubinius/issues/2200


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:54019] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
  2013-04-04 12:50 ` [ruby-core:53990] [ruby-trunk - Feature #8215][Closed] " Eregon (Benoit Daloze)
@ 2013-04-05  9:27 ` nobu (Nobuyoshi Nakada)
  2013-04-05 11:06 ` [ruby-core:54021] [ruby-trunk - Feature #8215] " Eregon (Benoit Daloze)
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-04-05  9:27 UTC (permalink / raw)
  To: ruby-core


Issue #8215 has been updated by nobu (Nobuyoshi Nakada).

Description updated
Status changed from Closed to Open

According to that rubinius issue tracker, it seems a feature request for Fiber#[] and Fiber#[]=.
----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-38259

Author: halorgium (Tim Carey-Smith)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 


=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:54021] [ruby-trunk - Feature #8215] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
  2013-04-04 12:50 ` [ruby-core:53990] [ruby-trunk - Feature #8215][Closed] " Eregon (Benoit Daloze)
  2013-04-05  9:27 ` [ruby-core:54019] [ruby-trunk - Feature #8215][Open] " nobu (Nobuyoshi Nakada)
@ 2013-04-05 11:06 ` Eregon (Benoit Daloze)
  2013-04-07 10:14 ` [ruby-core:54080] " halorgium (Tim Carey-Smith)
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Eregon (Benoit Daloze) @ 2013-04-05 11:06 UTC (permalink / raw)
  To: ruby-core


Issue #8215 has been updated by Eregon (Benoit Daloze).


Ah, sorry, I thought it was only misunderstanding of Thread#[] and such.
----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-38261

Author: halorgium (Tim Carey-Smith)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 


=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:54080] [ruby-trunk - Feature #8215] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
                   ` (2 preceding siblings ...)
  2013-04-05 11:06 ` [ruby-core:54021] [ruby-trunk - Feature #8215] " Eregon (Benoit Daloze)
@ 2013-04-07 10:14 ` halorgium (Tim Carey-Smith)
  2013-04-09  7:33 ` [ruby-core:54133] " nobu (Nobuyoshi Nakada)
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: halorgium (Tim Carey-Smith) @ 2013-04-07 10:14 UTC (permalink / raw)
  To: ruby-core


Issue #8215 has been updated by halorgium (Tim Carey-Smith).


=begin
Yup, I am sorry if that was not clear!

I also am very interested in being able to get the backtrace of a (({Fiber})) too. 

Should I open a new issue for (({Fiber#backtrace}))?
=end
----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-38328

Author: halorgium (Tim Carey-Smith)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 


=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:54133] [ruby-trunk - Feature #8215] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
                   ` (3 preceding siblings ...)
  2013-04-07 10:14 ` [ruby-core:54080] " halorgium (Tim Carey-Smith)
@ 2013-04-09  7:33 ` nobu (Nobuyoshi Nakada)
  2013-04-16  8:03 ` [ruby-core:54329] " nobu (Nobuyoshi Nakada)
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-04-09  7:33 UTC (permalink / raw)
  To: ruby-core


Issue #8215 has been updated by nobu (Nobuyoshi Nakada).


One ticket, one issue, please.
----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-38385

Author: halorgium (Tim Carey-Smith)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 


=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:54329] [ruby-trunk - Feature #8215] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
                   ` (4 preceding siblings ...)
  2013-04-09  7:33 ` [ruby-core:54133] " nobu (Nobuyoshi Nakada)
@ 2013-04-16  8:03 ` nobu (Nobuyoshi Nakada)
  2013-04-19  6:50 ` [ruby-core:54457] " halorgium (Tim Carey-Smith)
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-04-16  8:03 UTC (permalink / raw)
  To: ruby-core


Issue #8215 has been updated by nobu (Nobuyoshi Nakada).

File 0001-cont.c-fiber-local-accessors.patch added

More tests may be needed.
----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-38609

Author: halorgium (Tim Carey-Smith)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 


=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:54457] [ruby-trunk - Feature #8215] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
                   ` (5 preceding siblings ...)
  2013-04-16  8:03 ` [ruby-core:54329] " nobu (Nobuyoshi Nakada)
@ 2013-04-19  6:50 ` halorgium (Tim Carey-Smith)
  2013-04-19  7:01   ` [ruby-core:54460] moving issues (was: [ruby-trunk - Feature #8215] Support accessing Fiber-locals and backtraces for a Fiber) "Martin J. Dürst"
  2013-06-02  6:45 ` [ruby-core:55237] [ruby-trunk - Feature #8215][Assigned] Support accessing Fiber-locals and backtraces for a Fiber zzak (Zachary Scott)
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 14+ messages in thread
From: halorgium (Tim Carey-Smith) @ 2013-04-19  6:50 UTC (permalink / raw)
  To: ruby-core


Issue #8215 has been updated by halorgium (Tim Carey-Smith).


I realised that this might be better in common-ruby. 
I originally proposed the idea with RBX. 
Could someone move it?
----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-38739

Author: halorgium (Tim Carey-Smith)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 


=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:54460] moving issues (was: [ruby-trunk - Feature #8215] Support accessing Fiber-locals and backtraces for a Fiber)
  2013-04-19  6:50 ` [ruby-core:54457] " halorgium (Tim Carey-Smith)
@ 2013-04-19  7:01   ` "Martin J. Dürst"
  0 siblings, 0 replies; 14+ messages in thread
From: "Martin J. Dürst" @ 2013-04-19  7:01 UTC (permalink / raw)
  To: ruby-core; +Cc: halorgium (Tim Carey-Smith)

On 2013/04/19 15:50, halorgium (Tim Carey-Smith) wrote:
>
> Issue #8215 has been updated by halorgium (Tim Carey-Smith).
>
>
> I realised that this might be better in common-ruby.

This isn't issue specific: I propose that just for the moment, issues 
stay where they are. Once the overall directions are sorted out, we can 
organize a general campaign to move issues wherever necessary. If we can 
avoid it, we don't want to pollute each and every issue with individual 
move requests.

Regards,   Martin.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:55237] [ruby-trunk - Feature #8215][Assigned] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
                   ` (6 preceding siblings ...)
  2013-04-19  6:50 ` [ruby-core:54457] " halorgium (Tim Carey-Smith)
@ 2013-06-02  6:45 ` zzak (Zachary Scott)
  2020-01-05 22:51 ` [ruby-core:96674] [Ruby master Feature#8215] " samuel
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: zzak (Zachary Scott) @ 2013-06-02  6:45 UTC (permalink / raw)
  To: ruby-core


Issue #8215 has been updated by zzak (Zachary Scott).

Status changed from Open to Assigned
Assignee set to nobu (Nobuyoshi Nakada)


----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-39629

Author: halorgium (Tim Carey-Smith)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 


=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:96674] [Ruby master Feature#8215] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
                   ` (7 preceding siblings ...)
  2013-06-02  6:45 ` [ruby-core:55237] [ruby-trunk - Feature #8215][Assigned] Support accessing Fiber-locals and backtraces for a Fiber zzak (Zachary Scott)
@ 2020-01-05 22:51 ` samuel
  2020-01-05 22:51 ` [ruby-core:96675] " samuel
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: samuel @ 2020-01-05 22:51 UTC (permalink / raw)
  To: ruby-core

Issue #8215 has been updated by ioquatix (Samuel Williams).


@matz I agree with adding all three APIs, `Fiber#[]`, `Fiber#[]=` and `Fiber#backtrace`. Can you let me know if you are happy with these additions?

----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-83656

* Author: halorgium (Tim Carey-Smith)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
----------------------------------------
=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end


---Files--------------------------------
0001-cont.c-fiber-local-accessors.patch (2.94 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:96675] [Ruby master Feature#8215] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
                   ` (8 preceding siblings ...)
  2020-01-05 22:51 ` [ruby-core:96674] [Ruby master Feature#8215] " samuel
@ 2020-01-05 22:51 ` samuel
  2020-01-06 18:22 ` [ruby-core:96693] " eregontp
  2020-01-06 20:50 ` [ruby-core:96694] " samuel
  11 siblings, 0 replies; 14+ messages in thread
From: samuel @ 2020-01-05 22:51 UTC (permalink / raw)
  To: ruby-core

Issue #8215 has been updated by ioquatix (Samuel Williams).

Assignee changed from nobu (Nobuyoshi Nakada) to ioquatix (Samuel Williams)

----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-83657

* Author: halorgium (Tim Carey-Smith)
* Status: Assigned
* Priority: Normal
* Assignee: ioquatix (Samuel Williams)
* Target version: 
----------------------------------------
=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end


---Files--------------------------------
0001-cont.c-fiber-local-accessors.patch (2.94 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:96693] [Ruby master Feature#8215] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
                   ` (9 preceding siblings ...)
  2020-01-05 22:51 ` [ruby-core:96675] " samuel
@ 2020-01-06 18:22 ` eregontp
  2020-01-06 20:50 ` [ruby-core:96694] " samuel
  11 siblings, 0 replies; 14+ messages in thread
From: eregontp @ 2020-01-06 18:22 UTC (permalink / raw)
  To: ruby-core

Issue #8215 has been updated by Eregon (Benoit Daloze).


`Fiber#[]` and `Fiber#[]=` sounds fine, but what if somebody does:

`some_fiber = Fiber.new { ... }; Thread.new { some_fiber[:fiber_local] }`?

I think that should raise or not be possible.
If it would return the value, it would imply synchronization on every access to fiber locals which seems unfortunate.

By making the API `Fiber.[]`, we can avoid that entirely and have true fiber-locals, which can only be accessed by that Fiber:
```ruby
Fiber[:my_fiber_local] = 42
value = Fiber[:my_fiber_local]
# no way to access fiber locals of another Fiber
```

I think for new APIs we should take the chance to make them only possible to use correctly.
We could even finally have Fiber and Thread local in a consistent way:
```ruby
# access Fiber-local
Fiber[:my_fiber_local]
# access Thread-local
Thread[:my_thread_local]
```

----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-83678

* Author: halorgium (Tim Carey-Smith)
* Status: Assigned
* Priority: Normal
* Assignee: ioquatix (Samuel Williams)
* Target version: 
----------------------------------------
=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end


---Files--------------------------------
0001-cont.c-fiber-local-accessors.patch (2.94 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:96694] [Ruby master Feature#8215] Support accessing Fiber-locals and backtraces for a Fiber
  2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
                   ` (10 preceding siblings ...)
  2020-01-06 18:22 ` [ruby-core:96693] " eregontp
@ 2020-01-06 20:50 ` samuel
  11 siblings, 0 replies; 14+ messages in thread
From: samuel @ 2020-01-06 20:50 UTC (permalink / raw)
  To: ruby-core

Issue #8215 has been updated by ioquatix (Samuel Williams).


@eregon I agree with your points. I respect that you've studied a lot in your thesis so ultimately I'll defer to your judgement. But let me explain a bit more.

The reason for expanding the `Fiber#` interface is so that tools like `async` can show better debugging of all fibers.

Ideally it can show the backtrace, and allow the user to check fiber locals (and maybe even get a list of keys for debugging purposes).

I'd also be okay with adding `Fiber.[]` and so on, but that's kind of a separate issue.

Thread safety is not my concern, the function can be marked as thread unsafe, and maybe we can add detection of this and warn against it.

----------------------------------------
Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber
https://bugs.ruby-lang.org/issues/8215#change-83679

* Author: halorgium (Tim Carey-Smith)
* Status: Assigned
* Priority: Normal
* Assignee: ioquatix (Samuel Williams)
* Target version: 
----------------------------------------
=begin
As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals.

I would expect the following to work.

  Thread.current[:key] = "outside"
  fiber = Fiber.new do
    Thread.current[:key] = "inside"
    Fiber.yield
  end
  fiber.resume
  fiber[:key] == "inside" # true
  fiber.backtrace # ...

I also wonder whether (({Fiber#[]})) should be implemented, so (({Fiber.current[:key]})) is possible.

For reference, here is the issue on the rubinius issue tracker: ((<"github/rubinius/rubinius/2200"|URL:https://github.com/rubinius/rubinius/issues/2200>))
=end


---Files--------------------------------
0001-cont.c-fiber-local-accessors.patch (2.94 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-01-06 20:51 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-03 23:47 [ruby-core:53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber halorgium (Tim Carey-Smith)
2013-04-04 12:50 ` [ruby-core:53990] [ruby-trunk - Feature #8215][Closed] " Eregon (Benoit Daloze)
2013-04-05  9:27 ` [ruby-core:54019] [ruby-trunk - Feature #8215][Open] " nobu (Nobuyoshi Nakada)
2013-04-05 11:06 ` [ruby-core:54021] [ruby-trunk - Feature #8215] " Eregon (Benoit Daloze)
2013-04-07 10:14 ` [ruby-core:54080] " halorgium (Tim Carey-Smith)
2013-04-09  7:33 ` [ruby-core:54133] " nobu (Nobuyoshi Nakada)
2013-04-16  8:03 ` [ruby-core:54329] " nobu (Nobuyoshi Nakada)
2013-04-19  6:50 ` [ruby-core:54457] " halorgium (Tim Carey-Smith)
2013-04-19  7:01   ` [ruby-core:54460] moving issues (was: [ruby-trunk - Feature #8215] Support accessing Fiber-locals and backtraces for a Fiber) "Martin J. Dürst"
2013-06-02  6:45 ` [ruby-core:55237] [ruby-trunk - Feature #8215][Assigned] Support accessing Fiber-locals and backtraces for a Fiber zzak (Zachary Scott)
2020-01-05 22:51 ` [ruby-core:96674] [Ruby master Feature#8215] " samuel
2020-01-05 22:51 ` [ruby-core:96675] " samuel
2020-01-06 18:22 ` [ruby-core:96693] " eregontp
2020-01-06 20:50 ` [ruby-core:96694] " samuel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).