Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Sub::Quote deferred subs lose identity across threads

未关闭
#1,420 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
perl

调研方向

从 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

  1. Trace cloning of the deferred sub reference and the %DEFERRED metadata across thread creation.
  2. Compare PerlOnJava's handling of CLONE and stringified subreference keys with system Perl.
  3. 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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fglock/PerlOnJava 的其他 Issue

查看 fglock/PerlOnJava 的全部 Issue

相似的 Issue

更多 Perl Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。