Bug #1152
closedprofiler.rb is not concurrent-execution threadsafe
Description
=begin
The library profiler.rb uses class variables to store data without wrapping them in mutexes. On current C Ruby, this may only rarely cause a problem, but as more and more code is allowed to run in parallel it's going to lead to issues. If I or other JRuby community members have a chance, we'll try to make it thread-safe, but I wanted to file this issue to ensure it's out there.
The library is also largely unchanged in 1.9.1.
See http://jira.codehaus.org/browse/JRUBY-2133 for the (admittedly sparse) JRuby issue.
=end
Files
Updated by jabley (James Abley) over 15 years ago
- File 1152.patch 1152.patch added
=begin
Sample patch attached for discussion. There are style and best
practice issues with this patch due to my lack of ruby experience.
Please forgive and be so kind as to suggest improvements.
It is intended to highlight some of the areas that must be considered
when making the change to provide thread-safe profiling.
The patch alters the code to make the capture of the data thread-safe
AFAICT. There may be some issues with the data fields / calculations.
I wasn't completely clear what each field in the array was supposed to
be storing. The main issue unresolved by this patch is how best to
present the information.
I've opted for showing information per-thread and a summary as well.
- Should there be a version number outputted, in case downstream tools
are doing something with this information? - Any comments on how the information is being presented??
- Should profiling be configurable, so that it may not show output per
thread, etc.
=end
Updated by jabley (James Abley) over 15 years ago
- File 1152-2009-03-09.patch 1152-2009-03-09.patch added
=begin
Whoops. Wrong patch attached. Updated version.
=end
Updated by akr (Akira Tanaka) over 13 years ago
- Project changed from Ruby to Ruby master
Updated by naruse (Yui NARUSE) over 13 years ago
- Status changed from Open to Assigned
- Assignee set to shugo (Shugo Maeda)
Updated by shugo (Shugo Maeda) over 13 years ago
- Assignee changed from shugo (Shugo Maeda) to matz (Yukihiro Matsumoto)
I'm not the maintainer of profiler.rb. According to git blame,
it seems to be written by Matz and ocean, so I assign this ticket
to Matz.
Updated by ko1 (Koichi Sasada) over 12 years ago
- Assignee changed from matz (Yukihiro Matsumoto) to ko1 (Koichi Sasada)
I take it.
Updated by ko1 (Koichi Sasada) about 12 years ago
- Category set to lib
- Target version set to 2.0.0
Updated by ko1 (Koichi Sasada) almost 12 years ago
- Assignee changed from ko1 (Koichi Sasada) to nobu (Nobuyoshi Nakada)
nobu, could you check it?
Updated by nobu (Nobuyoshi Nakada) almost 12 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r38576.
Charles, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
profiler.rb: concurrent-execution
- lib/profiler.rb (Profiler__::PROFILE_PROC, print_profile): store
profile data per threads for concurrent-execution.
[ruby-core:22046] [Bug #1152]