[jira] [Closed] (ARTEMIS-4734) Null dereferencing in ReplicationManager.java

2024-06-19 Thread Justin Bertram (Jira)


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

Justin Bertram closed ARTEMIS-4734.
---
Resolution: Fixed

> 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
>Assignee: Justin Bertram
>Priority: Major
> Fix For: 2.34.0
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> {{repliToken}} can be 0.
> In 
> {{org.apache.activemq.artemis.core.replication.ReplicationManager#sendReplicatePacket(org.apache.activemq.artemis.core.protocol.core.Packet,
>  boolean, org.apache.activemq.artemis.utils.ReusableLatch)}} the 
> {{repliToken}} is initialized with the value returned by ([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)}}, i.e.:
> {code:java}
> final OperationContext repliToken = 
> OperationContextImpl.getContext(ioExecutorFactory);{code}
> Inside this method, a call is made to 
> {{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]),
>  which returns the value from the thread that was set earlier. If no value 
> was set in the stream, then token will be {{null}}.
> {code:java}
> OperationContext token = OperationContextImpl.threadLocalContext.get();{code}
> 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.
>  
>  



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

-
To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org
For additional commands, e-mail: issues-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact




[jira] [Closed] (ARTEMIS-4734) Null dereferencing in ReplicationManager.java

2024-05-29 Thread Clebert Suconic (Jira)


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

Clebert Suconic closed ARTEMIS-4734.


> 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
>Assignee: Justin Bertram
>Priority: Major
> Fix For: 2.34.0
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> {{repliToken}} can be 0.
> In 
> {{org.apache.activemq.artemis.core.replication.ReplicationManager#sendReplicatePacket(org.apache.activemq.artemis.core.protocol.core.Packet,
>  boolean, org.apache.activemq.artemis.utils.ReusableLatch)}} the 
> {{repliToken}} is initialized with the value returned by ([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)}}, i.e.:
> {code:java}
> final OperationContext repliToken = 
> OperationContextImpl.getContext(ioExecutorFactory);{code}
> Inside this method, a call is made to 
> {{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]),
>  which returns the value from the thread that was set earlier. If no value 
> was set in the stream, then token will be {{null}}.
> {code:java}
> OperationContext token = OperationContextImpl.threadLocalContext.get();{code}
> 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)

-
To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org
For additional commands, e-mail: issues-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact