You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "Chris Nauroth (Jira)" <ji...@apache.org> on 2022/10/28 21:40:00 UTC

[jira] [Assigned] (ZOOKEEPER-4460) QuorumPeer overrides Thread.getId with different semantics

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-4460?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Nauroth reassigned ZOOKEEPER-4460:
----------------------------------------

    Assignee: Chris Nauroth

Hello [~AlanBateman] . Thank you for notifying us about this. I reviewed the referenced {{QuorumPeer}} class here:

https://github.com/apache/zookeeper/blob/master/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java

I didn't find any occurrence of overriding {{Thread#getId()}}. There is a subclass of {{Thread}} in that code, and there is a declaration of a {{public long getId()}} method, but it's not part of the {{Thread}} subclass.

I also did a more exhaustive review of all {{Thread}} subclasses in the ZooKeeper codebase. I didn't find any overrides of {{getId()}}.

* Is it possible that this is a false positive?
* If not, then did your search identify a specific version of the ZooKeeper codebase? Perhaps this impacted an older version, but the code has since been changed?
* I believe Loom is targeted to Java 19? Assuming a future of ZooKeeper running on Java 19+ at some point, what kinds of problems would we see if we had an override of {{getId()}} that I failed to find?

Thanks again!

> QuorumPeer overrides Thread.getId with different semantics
> ----------------------------------------------------------
>
>                 Key: ZOOKEEPER-4460
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4460
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Alan Bateman
>            Assignee: Chris Nauroth
>            Priority: Major
>
> In OpenJDK, Project Loom has significantly re-implemented java.lang.Thread. One part of this is using some of the bits in the thread identifier for non-exposed purposes. Sadly, Thread::getId is not final and it's possible that sub-classes of Thread have overridden getId to have different semantics. The JDK can defend against this but there may be 3rd party libraries that make use of Thread::getId. A corpus search of Maven central found only one class: org.apache.zookeeper.server.quorum.QuorumPeer. Does this project know why getId has been overridden to return something that is not the thread identifier?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)