{{ message }}
Repository navigation
Commit 6ef6687
fix(profiler): address code-review findings on PR #540
Code review surfaced 7 findings — 4 CONFIRMED, 3 PLAUSIBLE. This
commit addresses all 7:
#8 (CONFIRMED) — split isInSignalContext into a strict variant.
dlopen_hook was treating null ProfiledThread as "in signal" and
deferring refresh on every dlopen from uninstrumented JVM threads
(VM Thread, JIT, GC), delaying wasmtime sigaction patching by up
to 500 ms. Add isInTrackedSignalContext() that returns false on
null (only true when one of our SignalHandlerScopes is positively
on the stack); dlopen_hook now uses it so JVM-internal threads
get synchronous refresh again. isInSignalContext() retains its
conservative semantics for any future caller that wants
AS-safe-by-default.
#7 (CONFIRMED) — switchLibraryTrap was called before startRefresher
despite the invariant comment. Reorder so the refresher is
running before the trap can fire.
#9 (CONFIRMED) — DEBUG_ASSERT_NOT_IN_SIGNAL was on the 1-arg and
2-arg Dictionary::lookup overloads but missed the 4-arg form
that actually mallocs. bounded_lookup's runtime-decided
for_insert path was uncovered. Move the assertion into the
4-arg lookup, gated on for_insert (read-only lookups are
AS-safe).
#4 (CONFIRMED) — Comments referenced "REFRESH_INTERVAL_NS (5s)"
but the actual constant is 500 ms. Fix both stale mentions.
#13 (PLAUSIBLE) — SIGNAL_HANDLER_GUARD_RELEASE before chaining
leaves depth == 0 inside a chained handler that returns
normally; DEBUG_ASSERT_NOT_IN_SIGNAL inside such a handler
would not fire. Document the trade-off in segvHandler — the
longjmp safety property is more important than the sanitizer
coverage gap, which is bounded to third-party signal handler
code we don't own.
#2 (PLAUSIBLE) — refresherLoop used OS::sleep without an EINTR
loop; any unmasked signal (SIGCHLD, SIGURG, RT signals) would
cause premature ticks. Wrap the sleep in an explicit
elapsed-time loop using OS::nanotime so the refresher ticks at
500 ms regardless of stray signals.
#14 (PLAUSIBLE) — refresherLoop published _refresher_tid before
blocking SIGPROF/SIGVTALRM; a stale per-thread timer from a
previous lifecycle could fire on the refresher during the
window. Block signals first, then publish the TID.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f77ba1a commit 6ef6687
6 files changed
Lines changed: 99 additions & 29 deletions
File tree
- ddprof-lib/src
- main/cpp
- test/cpp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
38 | 46 | | |
39 | 47 | | |
40 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
64 | 75 | | |
65 | 76 | | |
66 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
| |||
85 | 84 | | |
86 | 85 | | |
87 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
89 | | - | |
90 | | - | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
92 | 108 | | |
93 | 109 | | |
94 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
777 | 777 | | |
778 | 778 | | |
779 | 779 | | |
780 | | - | |
781 | | - | |
782 | | - | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
783 | 791 | | |
784 | 792 | | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
794 | 798 | | |
795 | 799 | | |
796 | 800 | | |
| |||
837 | 841 | | |
838 | 842 | | |
839 | 843 | | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
840 | 851 | | |
841 | 852 | | |
842 | 853 | | |
| |||
1313 | 1324 | | |
1314 | 1325 | | |
1315 | 1326 | | |
1316 | | - | |
1317 | | - | |
1318 | | - | |
1319 | 1327 | | |
1320 | 1328 | | |
1321 | | - | |
| 1329 | + | |
1322 | 1330 | | |
1323 | 1331 | | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
1324 | 1335 | | |
1325 | 1336 | | |
1326 | 1337 | | |
| |||

0 commit comments