Avoid repeated reachability walks while Moose modules initialize
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Start in WeakRefRegistry.weaken(), at the weakenedLiveBlessedRef condition, where reachableOwnerCount() is evaluated before ModuleInitGuard.inModuleInit(). Follow reachableOwnerCount() into ReachabilityWalker.isScalarReachable() to see the root walk. Reorder the check, add a deterministic regression test for module initialization, and confirm weak-reference behaviour outside module init. Done when t/05_round.t finishes on both the JVM and interpreter backends.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
Loading StorageDisplay 1.0.11 through Moose triggers a large number of Scalar::Util::weaken calls. For live blessed references, WeakRefRegistry.weaken() calls reachableOwnerCount(), which repeatedly walks the Perl object graph. The module-initialization guard is checked only after this expensive query, so it does not suppress the work during module loading. The repeated walks make t/05_round.t exceed the CPAN tester timeout on both PerlOnJava backends.
Evidence
- CPAN random tester run:
20261102-094403-98885 - Distribution:
StorageDisplay-1.0.11; failing test:t/05_round.t - System Perl 5.42.2: full suite passed, 7 files / 85 tests, in about 6 seconds.
- PerlOnJava 5.44.1 / Java 24.0.2: CPAN run timed out after 120 seconds with no output for 60 seconds. Focused runs of
t/05_round.twith the archived dependency overlay exceeded a 40-second hard timeout on both JVM and interpreter backends. - An 8-second JVM Flight Recorder profile of
use StorageDisplayshowed repeated stacks throughScalarUtil.weaken,RuntimeBase.reachableOwnerCount, andReachabilityWalkerroot traversal. This is repeated work, not evidence of an infinite loop.
StorageDisplay is pure Perl and uses Moose 2.4000 and namespace::sweep 0.006. The PerlOnJava report showed t/000-report-versions.t passing before the harness stopped producing output.
Suspected cause
In WeakRefRegistry.weaken(), the condition at the weakenedLiveBlessedRef check evaluates base.reachableOwnerCount() == 0 before !ModuleInitGuard.inModuleInit(). reachableOwnerCount() checks each active owner using ReachabilityWalker.isScalarReachable(), which traverses the global root graph. Moose performs many such weaken operations while required modules execute under ModuleInitGuard, multiplying full root walks during initialization.
Move the module-init check ahead of the reachability query, then confirm the same behavior is preserved outside module initialization.
Acceptance criteria
- Add deterministic regression coverage proving module initialization does not perform the expensive reachable-owner walk for this path.
- Run new/changed Perl-level coverage with system Perl first.
t/05_round.tcompletes under PerlOnJava's JVM and interpreter backends with the archived dependency load order.- Run the required build and lifecycle tests; retain bounded output and verify weak-reference semantics outside module initialization.
Related: #1642 and merged PR #1746 addressed other repeated reachability paths during cleanup. This CPAN case reproduces through WeakRefRegistry.weaken() during module initialization.
- Vorherrschende Sprache
- Perl
- Sterne
- 65
- Forks
- 8
- Ø Merge
- 5 Std. 45 Min.
- Gemergte PRs (30 T.)
- 184
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus fglock/PerlOnJava
-
area:runtime documentation enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
fglock/PerlOnJava#1579 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:backend bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
fglock/PerlOnJava#1981 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:runtime bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 57/100
fglock/PerlOnJava#1980 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:parser bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
fglock/PerlOnJava#1979 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:cpan-port bug
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
fglock/PerlOnJava#1962 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in fglock/PerlOnJava
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
libwww-perl/HTTP-Message#236 ·
-
1.severity: security
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 2 Tagen
-
wave-followup
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
-
benchmarks/README: 'perl BNG2.pl model.bngl' runs the whole protocol, not just generate_networkOffendocumentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag