Bug 14511 – Profiler does not work with multithreaded programs

Status
REOPENED
Severity
major
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-04-27T10:12:00Z
Last change time
2024-12-07T13:35:16Z
Assigned to
No Owner
Creator
Walter Bright
See also
https://issues.dlang.org/show_bug.cgi?id=14000, https://issues.dlang.org/show_bug.cgi?id=15947
Moved to GitHub: dmd#17299 →

Comments

Comment #0 by bugzilla — 2015-04-27T10:12:00Z
The global data usage is not synchronized, so the profiler fails, probably with a seg fault, on multi-threaded programs.
Comment #1 by bugzilla — 2015-04-27T10:24:56Z
Comment #2 by github-bugzilla — 2015-04-29T04:24:32Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/01087ce464d3b905d16e55799d02b710fcdd9939 fix Issue 14511 - Profiler does not work with multithreaded programs https://github.com/D-Programming-Language/druntime/commit/0f4f326fb476bbf80ca95e8f368bbb2c3d2f260d Merge pull request #1233 from WalterBright/fix14511 fix Issue 14511 - Profiler does not work with multithreaded programs
Comment #3 by github-bugzilla — 2015-06-17T21:02:30Z
Comment #4 by zoteman94 — 2016-01-12T14:27:32Z
static int bar[]; void main () { import std.concurrency : spawn; spawn ( & foo ); } void foo () { bar ~= 0; } This program segfaults if compiled with -profile=gc. Seems to happen at rt_term of runAll at dmain2.d.
Comment #5 by jj75607 — 2016-04-18T07:43:38Z
Profiler fails with atomic operations: import core.atomic; shared struct S { uint counter; bool inc() shared { atomicOp!("+=")(counter, 1); return true; } } int main(string[] argv) { S s; return 0; } This program segfaults if compiled with profiler hooks
Comment #6 by sascha.orlov — 2016-11-08T12:32:11Z
After an update from 2.071.2 to 2.072.0 a seg fault with the profile option on a mac appear with the following example void main() {} void f() { import core.atomic: atomicOp; shared size_t workUnitIndex; atomicOp!"+="(workUnitIndex, 1); } which does not appear with the prior version of atomic.d Many thanks to ag0aep6g for helping with the code.
Comment #7 by github-bugzilla — 2017-07-19T17:41:29Z
Commits pushed to dmd-cxx at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/01087ce464d3b905d16e55799d02b710fcdd9939 fix Issue 14511 - Profiler does not work with multithreaded programs https://github.com/dlang/druntime/commit/0f4f326fb476bbf80ca95e8f368bbb2c3d2f260d Merge pull request #1233 from WalterBright/fix14511
Comment #8 by robert.schadek — 2024-12-07T13:35:16Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17299 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB