[ 
https://issues.apache.org/jira/browse/IGNITE-20296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17785641#comment-17785641
 ] 

Vladislav Pyatkov commented on IGNITE-20296:
--------------------------------------------

The issue can also be a cause of NPE:
{noformat}
[2023-11-13T18:20:55,718][ERROR][%idft_tcpof_2%MessagingService-inbound--0][DefaultMessagingService]
 onMessage() failed while processing InvokeRequestImpl [correlationId=3065, 
message=TxFinishReplicaRequestImpl [commit=true, 
commitTimestampLong=111404622984577024, groupId=6_part_0, groups=HashSet 
[6_part_0], term=111404622950498310, timestampLong=11140462298457
7026, txId=018bc9ea-1343-0000-0000-000009a89413]] from idft_tcpof_0
java.lang.NullPointerException: null
        at 
org.apache.ignite.internal.replicator.ReplicaManager.onReplicaMessageReceived(ReplicaManager.java:292)
 ~[ignite-replicator-3.0.0-SNAPSHOT.jar:?]
        at 
org.apache.ignite.network.DefaultMessagingService.onMessage(DefaultMessagingService.java:390)
 ~[ignite-network-3.0.0-SNAPSHOT.jar:?]
        at 
org.apache.ignite.network.DefaultMessagingService.lambda$onMessage$4(DefaultMessagingService.java:350)
 ~[ignite-network-3.0.0-SNAPSHOT.jar:?]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
[?:?]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
[?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]
{noformat}
This stack points to this line:
{code}
// TODO IGNITE-20296 Id of the node should come along with the message itself.
String senderId = 
clusterNetSvc.topologyService().getByConsistentId(senderConsistentId).id();
{code}

> Make a network message handler that would be able to accept ClusterNode as a 
> sender
> -----------------------------------------------------------------------------------
>
>                 Key: IGNITE-20296
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20296
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Denis Chudov
>            Priority: Major
>              Labels: ignite-3
>
> *Motivation*
> With {{MessagingService}} we have an ability to send message using 
> {{ClusterNode}} to specify a recipient. But in {{NetworkMessageHandler}} we 
> have only ability to receive consistent id of a sender. However, in some 
> cases we need node id (for example, knowing that there is no node we the 
> given id in a cluster, allows us to not send message there at all, because 
> this node has left the topology at least once since it had sent this message 
> and therefore this node lost its volatile state)
> Also, the node id should go along with consistent id, so 
> {color:#172b4d}{{ClusterNode}} {color}as the argument type is preferred.
> *Definition of done*
> The following interface is available:
> {code:java}
> public interface NetworkMessageHandler {
>     /**
>      * Method that gets invoked when a network message is received.
>      *
>      * @param message Message, which was received from the cluster.
>      * @param sender Sender node.
>      * @param correlationId Correlation id. Used to track correspondence 
> between requests and responses. Can be {@code null} if the received
>      *     message is not a request from a {@link MessagingService#invoke} 
> method from another node.
>      */
>     void onReceived(NetworkMessage message, ClusterNode sender, @Nullable 
> Long correlationId);
> } {code}
> Also, the {{MessagingService}} is able to accept an object implementing this 
> interface as a message handler.
> *Implementation notes*
> The ClusterNode passed as a sender should have a node id which the sender 
> node had at the moment the message was sent.



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

Reply via email to