Sub::Quote deferred subs lose identity across threads
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- perl
- 领域
- backend, testing-qa
调研方向
从 t/sub-quote-threads.t 开始,并使用针对 JVM 和解释器后端显示的两个命令分别复现它。阅读 Sub/Defer.pm 第 75 行附近的内容及其 CLONE 实现,然后跟踪线程创建过程中的 deferred-sub 引用和 %DEFERRED。完成的标准是 quoted 和 deferred subs 保留其身份,并且聚焦的回归测试在两个后端上都通过。
由索引模型根据 Issue 内容生成。
描述
Summary
Sub::Quote 2.006009 fails when quoted/deferred subs are retrieved or invoked from PerlOnJava threads. The failure reproduces on both the JVM and interpreter backends.
Reproduction
The CPAN random tester record is:
2026-09-18 07:06:07 FAIL Sub::Quote Sub::Defer ... 5430 5435 5/5435 subtests failed; 1/15 test programs failed
The failing test is:
t/sub-quote-threads.t
Using the built distribution with its library and test-library paths:
timeout 120 ./jperl -I<build>/blib/lib -I<build>/t/lib <build>/t/sub-quote-threads.t
timeout 120 ./jperl --interpreter -I<build>/blib/lib -I<build>/t/lib <build>/t/sub-quote-threads.t
Both backends fail identically: 5 of 6 assertions fail. The only passing assertion is the unquoted One case. Quoted/deferred sub retrieval and execution return undef, including the two-thread cases.
The complete CPAN run has 14 of 15 test programs passing; only t/sub-quote-threads.t fails. PerlOnJava also emits:
Use of uninitialized value in hash element at .../Sub/Defer.pm line 75
Expected behavior
System Perl passes the complete oracle run: 7036/7036 tests, including t/sub-quote-threads.t.
Technical analysis
Sub::Defer::undefer_sub looks up deferred-sub metadata in %DEFERRED using the deferred sub reference. Sub::Defer provides a CLONE implementation specifically to repair stringified subreference keys after threading.
On PerlOnJava, the lookup at Sub/Defer.pm line 75 receives an undefined or otherwise non-matching key after the thread boundary. This indicates that thread cloning is not preserving or remapping the identity/metadata of deferred quoted subs as required by Sub::Defer::CLONE.
The issue is present in both execution backends, so it appears to be shared runtime/thread-cloning behavior rather than a JVM-backend-only problem or a module-specific compilation issue.
Impact
Non-threaded Sub::Quote functionality passes, but applications using quoted/deferred subs from Perl threads can silently receive undef or fail to invoke the intended subroutine. This is a compatibility bug affecting modules that use Sub::Quote together with threads.
Suggested investigation
- Trace cloning of the deferred sub reference and the
%DEFERREDmetadata across thread creation. - Compare PerlOnJava's handling of
CLONEand stringified subreference keys with system Perl. - Add a focused project-owned regression test covering
quote_sub,quoted_from_sub,unquote_sub, and deferred-sub invocation from a child thread on both backends.
- 主要语言
- Perl
- 星标
- 64
- 派生
- 6
- 平均合并
- 5 小时 38 分钟
- 30 天内合并 PR
- 170
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fglock/PerlOnJava 的其他 Issue
-
area:cpan-port area:unicode bug
难度 2/5 1-3 小时 新手友好度 88/100
fglock/PerlOnJava#1341 ·
-
area:backend area:runtime bug
难度 4/5 3-5 天 新手友好度 45/100
fglock/PerlOnJava#1511 ·
-
area:backend area:cpan-port bug
难度 4/5 3-5 天 新手友好度 45/100
fglock/PerlOnJava#1508 · 1 条评论 ·
-
area:cpan-port area:platform enhancement
难度 5/5 一周以上 新手友好度 30/100
fglock/PerlOnJava#1507 ·
-
bug
难度 4/5 3-5 天 新手友好度 45/100
fglock/PerlOnJava#1506 ·
查看 fglock/PerlOnJava 的全部 Issue
相似的 Issue
-
documentation Needs Triage
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
trizen/youtube-viewer#456 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
connectivity 未关闭
难度 1/5 1 小时以内 新手友好度 80/100
-
Common US ingredient names are not recognized, so about 12.4k US products miss an allergen warning 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
openfoodfacts/openfoodfacts-server#14657 · 4 条评论 ·