You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Justin Bertram (Jira)" <ji...@apache.org> on 2024/04/22 17:37:00 UTC
[jira] [Commented] (ARTEMIS-4734) Null dereferencing in ReplicationManager.java
[ https://issues.apache.org/jira/browse/ARTEMIS-4734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17839801#comment-17839801 ]
Justin Bertram commented on ARTEMIS-4734:
-----------------------------------------
bq. repliToken can be 0.
This doesn't make sense. Do you mean "{{repliToken}} can be {{null}}"?
> Null dereferencing in ReplicationManager.java
> ---------------------------------------------
>
> Key: ARTEMIS-4734
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4734
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Galkin Alexey
> Priority: Major
>
> repliToken can be 0.
> In this code, the repliToken is initialized with the value returned by the method ([line 464|https://github.com/apache/activemq-artemis/blob/main/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java]) OperationContextImpl.getContext(ioExecutorFactory)
> final OperationContext repliToken = OperationContextImpl.getContext(ioExecutorFactory);
> Inside this method, a call is made to the OperationContextImpl.threadLocalContext.get()([line 61|https://github.com/apache/activemq-artemis/blob/main/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextImpl.java]) method, which returns the value from the thread that was set earlier. If no value was set in the stream, then token will be null.
> OperationContext token = OperationContextImpl.threadLocalContext.get();
> If ioExecutorFactory is null and there is no value set in the thread, then the repliToken will remain null because the backing getContext() method also returns null in this case.
> So repliToken can be 0 if ioExecutorFactory is null and there is no value set in the thread.
> Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
> Author Alexey Galkin.
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)