Hi.

Just figured out while the example setup doesn't produce the error. The 
following TestClient will always cause the exception at the server.

public class TestClient {

       public static void main(String[] args) {
             IgniteConfiguration igniteConfiguration = new 
IgniteConfiguration();
             igniteConfiguration.setClientMode(true);
             igniteConfiguration.setMetricsLogFrequency(0);
             Ignite ignite = Ignition.start(igniteConfiguration);

             Scanner scanner = new Scanner(System.in);
             while (true) {
                    String message = scanner.nextLine();
                    IgniteMessaging messaging = 
ignite.message(ignite.cluster());
                    messaging.send("test", new ComplexMessage(message));
             }


       }
}

Ignite.message(...) is now called before each message is send. In the main 
application it is called only once.
I also noticed I didn't describe the steps to reproduce the problem very 
detailed yesterday evening.


  1.  Start 1 Client and 1 Server
  2.  Type in some message in the client console and hit Enter
  3.  Check that message is received and logged by the server
  4.  Stop the Server
  5.  Start the Server and wait for the client to reconnect
  6.  Type in another message in the client console and hit Enter
  7.  See the Exception at the server log

Also one additional note. This only happens if all cluster servers are offline 
and the cluster gets restartet. If you have multiple servers there is no 
problem. At least one server must survive to keep the record on how to 
unmarshall the sent class.

Best regards,
Sebastian Sindelar

Von: Sebastian Sindelar [mailto:[email protected]]
Gesendet: Mittwoch, 19. Juli 2017 16:53
An: [email protected]
Betreff: Problem with Messages after client reconnect

Hi.

I just started with Ignite messaging and I encountered the following problem:

I have a simple Setup with 1 server and 1 client. Sending messages from the 
client to the server works fine. But after a server restart I encounter the 
problem that when I send a message with a custom class I get an unmarshalling 
error:


org.apache.ignite.IgniteCheckedException: null
       at 
org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9893) 
~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.managers.communication.GridIoManager$GridUserMessageListener.onMessage(GridIoManager.java:2216)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1257)
 [ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.managers.communication.GridIoManager.access$2000(GridIoManager.java:114)
 [ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.managers.communication.GridIoManager$GridCommunicationMessageSet.unwind(GridIoManager.java:2461)
 [ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.managers.communication.GridIoManager.unwindMessageSet(GridIoManager.java:1217)
 [ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.managers.communication.GridIoManager.access$2300(GridIoManager.java:114)
 [ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.managers.communication.GridIoManager$8.run(GridIoManager.java:1186)
 [ignite-core-2.0.0.jar:2.0.0]
       at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
[na:1.8.0_112]
       at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
[na:1.8.0_112]
       at java.lang.Thread.run(Thread.java:745) [na:1.8.0_112]
Caused by: java.lang.NullPointerException: null
       at 
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl.metadata(CacheObjectBinaryProcessorImpl.java:492)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$2.metadata(CacheObjectBinaryProcessorImpl.java:174)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.binary.BinaryContext.metadata(BinaryContext.java:1231)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.binary.BinaryReaderExImpl.getOrCreateSchema(BinaryReaderExImpl.java:1987)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.binary.BinaryReaderExImpl.<init>(BinaryReaderExImpl.java:283)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.binary.BinaryReaderExImpl.<init>(BinaryReaderExImpl.java:182)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.binary.BinaryReaderExImpl.<init>(BinaryReaderExImpl.java:161)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.binary.GridBinaryMarshaller.deserialize(GridBinaryMarshaller.java:304)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.binary.BinaryMarshaller.unmarshal0(BinaryMarshaller.java:99)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:82)
 ~[ignite-core-2.0.0.jar:2.0.0]
       at 
org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9887) 
~[ignite-core-2.0.0.jar:2.0.0]
       ... 10 common frames omitted

Sending String or Integer Messages works fine.

I tried to boil it down into a simple server and client but can't reproduce the 
behaivor exactly:

public class TestServer {
       public static void main(String[] args) {
             IgniteConfiguration igniteConfiguration = new 
IgniteConfiguration();
             igniteConfiguration.setMetricsLogFrequency(0);
             Ignite ignite = Ignition.start(igniteConfiguration);

             IgniteMessaging messaging = ignite
                           .message(ignite.cluster());
             messaging.localListen("test", (nodeId, msg) -> {
                    System.out.println("Message received: '" + msg + "' von '" 
+ nodeId + "'");
                    return true;
             });
       }
}

public class TestClient {

       public static void main(String[] args) {
             IgniteConfiguration igniteConfiguration = new 
IgniteConfiguration();
             igniteConfiguration.setClientMode(true);
             igniteConfiguration.setMetricsLogFrequency(0);
             Ignite ignite = Ignition.start(igniteConfiguration);
             IgniteMessaging messaging = ignite.message(ignite.cluster());

             Scanner scanner = new Scanner(System.in);
             while (true) {
                    String message = scanner.nextLine();
                    messaging.send("test", new ComplexMessage(message));
             }
       }
}

public class ComplexMessage {
       private final String message;
       public ComplexMessage(String message) {
             super();
             this.message = message;
       }

       @Override
       public String toString() {
             return String.format("ComplexMessage [message=%s]", message);
       }
}


I tried to play around with different clustergroups (e.g. .forRemotes()) but 
most oft he time after the reconnect the server doesn't receive any messages at 
all, but I also had the unmarshalling NPE. I think understand something 
fundamentally wrong about the ignite messaging or the client reconnect.

Sincerly,
Sebastian



Mit freundlichen Grüßen / Best regards,
Sebastian Sindelar
________________________________________________________________
IBH Datentechnik GmbH
Mendelssohn-Bartholdy-Str.17
34134 Kassel

Tel.: +49 (0)561 942880
Fax: +49 (0)561 9428877
Support: +49 (0)561 9428899


E-Mail: [email protected] <mailto:[email protected]>

Sitz der Gesellschaft / Domicile of the Company: Kassel
Registergericht / Register Court: Amtsgericht Kassel HRB 5096
USt.-Nr: / VAT-ID: DE113075366
Geschäftsführer / Managing Director: Bernd Hähner

Diese E-Mail enthält vertrauliche und / oder rechtlich geschützte 
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail 
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und 
vernichten Sie diese Mail. Wir verwenden aktuelle Virenschutzprogramme. Für 
Schäden, die dem Empfänger gleichwohl durch von uns oder unter unserem Namen 
zugesandte mit Viren befallene E-Mails entstehen, schließen wir jede Haftung 
aus.
This e-mail may contain confidential and / or privileged information. If you 
are not the intended recipient or have received this e-mail in error please 
notify the sender immediately and destroy this e-mail. We use updated antivirus 
protection software. We do not accept any responsibility for damages caused 
anyhow by viruses transmitted via e-mail.

Reply via email to