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

Object::ID object_id is not stable across threads

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

还没有人认领这个 Issue。

评估

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

调研方向

从 Object::ID 的 t/threads.t 开始,在 JVM 和 interpreter 两个后端上重现这些失败。跟踪 Hash::FieldHash 如何在子线程访问期间存储父线程的 object ID,然后验证测试在两个后端上都能通过,并且现有的 Hash::FieldHash 和线程测试仍然通过。

由索引模型根据 Issue 内容生成。

描述

bug

Object::ID threaded object identity differs from system Perl

Summary

The CPAN compatibility run for Object::ID v0.1.2 reports 5 failing assertions in t/threads.t. The failure is reproducible on both the JVM backend and the interpreter backend and appears to be a PerlOnJava ithreads/object-identity bug involving the field storage used by Hash::FieldHash.

Evidence
  • CPAN run: 20260916-111623-23683
  • Distribution: Object-ID v0.1.2
  • Test: t/threads.t
  • System Perl: the focused upstream test passes, including all 11 object identity assertions.
  • PerlOnJava JVM backend: 5 of 11 assertions fail.
  • PerlOnJava interpreter backend: 5 of 11 assertions fail.

The failing assertions all have the same shape:

object_id in a thread: got c, expected b

The test creates one object, records its object_id, then checks that the same object has the same ID from five child threads. PerlOnJava assigns a different ID in the child-thread view, while system Perl preserves the identity.

Suspected cause

Object::ID stores IDs in a Hash::FieldHash fieldhash. The parent thread assigns the object ID before starting the threads. When the object is accessed by a child thread, the fieldhash mapping does not appear to be preserved or shared with the cloned object state, so object_id allocates a new ID instead of returning the parent-thread ID.

Because both execution backends reproduce the same result, this is likely in shared thread/object cloning or fieldhash integration rather than in only one compiler backend.

Reverse-dependency impact

MetaCPAN reports 7 released distributions with a runtime dependency on Object::ID; one has a release within the last three years (StorageDisplay). The dependants include StorageDisplay, MooX-Struct, perl5i, Fey-ORM, Role-Commons, Test-Proto, and Module-Install-RDF.

The underlying Hash::FieldHash dependency has 17 released runtime dependants, but none has released within the last three years. This broader count is contextual; the observed defect is specifically threaded use of Object::ID, so the practical affected surface is narrower than the total dependant count.

Suggested acceptance criteria
  1. Object::ID t/threads.t passes on the JVM backend.
  2. The same test passes on the interpreter backend.
  3. The object ID remains stable when the object is accessed from all child threads.
  4. Existing Hash::FieldHash and thread tests continue to pass.
主要语言
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 摘要。