question

Upvotes
Accepted
1 0 1 4

EMA Java Api: NullPointerException in ItemCallbackClient:processStatusMsg

In case you're wondering, from the stack trace below, I re-named the jar "1.0.0" when registering with my local MAVEN repo. But, this is from the first (non-beta) release of the Java EMA Elektron API. This may be related to the other question I have posted today, as "Unknown Source" looks suspicious.

I am using a recorded rwf file and using the sink_driven_src tool. The code is based on example 370. Except, I am requesting *multiple* batches of 50 rics. Each batch request is a repeat of lines 126-134 from the example, for each different batch of rics I am requesting.

This error is intermittent occurring only 1 in 10 times, using the same playback file. But, when it does, the feed hangs and I get no more refresh or update messages coming through.

Error Stack Trace:

6809 [pool-58-thread-1] ERROR o.a.s.s.o.a.z.s.NIOServerCnxnFactory - Thread Thread[pool-58-thread-1,5,main] died java.lang.NullPointerException at com.thomsonreuters.ema.access.ItemCallbackClient.processStatusMsg(Unknown Source) ~[ema-1.0.0.jar:?] at com.thomsonreuters.ema.access.ItemCallbackClient.defaultMsgCallback(Unknown Source) ~[ema-1.0.0.jar:?] at com.thomsonreuters.upa.valueadd.reactor.Reactor.sendDefaultMsgCallback(Unknown Source) ~[upavalueadd-1.0.0.jar:${version}] at com.thomsonreuters.upa.valueadd.reactor.Reactor.sendAndHandleDefaultMsgCallback(Unknown Source) ~[upavalueadd-1.0.0.jar:${version}] at com.thomsonreuters.upa.valueadd.reactor.WlItemHandler.callbackUser(Unknown Source) ~[upavalueadd-1.0.0.jar:${version}] at com.thomsonreuters.upa.valueadd.reactor.WlItemHandler.dispatch(Unknown Source) ~[upavalueadd-1.0.0.jar:${version}] at com.thomsonreuters.upa.valueadd.reactor.Watchlist.dispatch(Unknown Source) ~[upavalueadd-1.0.0.jar:${version}] at com.thomsonreuters.upa.valueadd.reactor.Reactor.processWorkerEvent(Unknown Source) ~[upavalueadd-1.0.0.jar:${version}] at com.thomsonreuters.upa.valueadd.reactor.Reactor.dispatchChannel(Unknown Source) ~[upavalueadd-1.0.0.jar:${version}] at com.thomsonreuters.upa.valueadd.reactor.ReactorChannel.dispatch(Unknown Source) ~[upavalueadd-1.0.0.jar:${version}] at com.thomsonreuters.ema.access.OmmConsumerImpl.rsslReactorDispatchLoop(Unknown Source) ~[ema-1.0.0.jar:?] at com.thomsonreuters.ema.access.OmmConsumerImpl.run(Unknown Source) ~[ema-1.0.0.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_77] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_77] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_77]

elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-apijavaerror
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
20.3k 73 10 20

@Raven

Have you tried not using the Batch feature and just requesting each item individually?

If you refer to the post on another Batch related thread The batch request mechanism is an odd anachronism in RSSL you will note that EMA creates an individual request for each item before it sends it out on the wire anyway.

So, instead of looping to add your instruments to the OmmArray, you could use the loop to registerClient for your instruments...

I realise that this does not address the above and the OmmArray issue above still needs to be investigated - just trying to be pragmatic so you can move forward with your development.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
103 0 2 1

Related to the "Unknown source" issue... have you tried the same scenario without renaming the ema.jar file? If yes, was the call stack correct or still indicating the "Unknown source"?

Related to the crash / null pointer... please provide / attach the files with your application... if possible of course...

Thanks

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
281 1 3 7

@Raven We have been able to reproduce the same stack trace with the NPE error, by having multiple threads invoked registerClient method of the same (shared) OmmConsumer instance. This is likely a race condition when the method is invoked by multiple threads in order to send requests. We have created the Case: 04745892 for this issue and will provide you with more update after checking with the development on this.

By the way, did your application use multiple threads to send batch requests? If so, it would be the same scenario that we have been able to re-create.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
1 0 1 4

Thank you, for pursuing this. In answer to your question - no, I am not invoking requests on multiple threads. I am instead having to make repeated calls on the same consumer, placing 50 names at a time in a loop. The repeated process, as per Example 370 is OmmArrayEntry -> which is added as an ENAME_BATCH_ITEM_LIST into an ElementEntry, which in turn is added to an ElementList -> which is finally added as a payload to a ReqMsg.

It all feels way over complicated and I am left wondering whether there isn't a simpler solution (one that might also get me round this NPE issue).

The first thing that seems odd, is that I can't just add all 2000 names to one OmmArray. If I try to add more than say 50 (it might be 100, but thereabouts), I get :-

java.lang.ClassCastException: com.thomsonreuters.upa.codec.ArrayImpl cannot be cast to com.thomsonreuters.upa.codec.ElementListImpl
at com.thomsonreuters.upa.codec.Decoders.decodeElementEntry(Decoders.java:1181) ~[upa-1.0.0.jar:etaj3.0.0.L1]
at com.thomsonreuters.upa.codec.ElementEntryImpl.decode(ElementEntryImpl.java:122) ~[upa-1.0.0.jar:etaj3.0.0.L1]
at com.thomsonreuters.ema.access.ReqMsgImpl.checkBatchView(Unknown Source) ~[ema-1.0.0.jar:?]
at com.thomsonreuters.ema.access.ReqMsgImpl.payload(Unknown Source) ~[ema-1.0.0.jar:?] 
...

Is there no way I can easily add all 2000 names in one go, without having to chunk to around 50 at a time? I have tried adding multiple ElementEntries (each holding a ENAME_BATCH_ITEM_LIST OmmArray) but I get the same exception, as above.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
281 1 3 7

@Raven I've been able to reproduce the ClassCastException (with identical stack trace) when trying to send a batch request of large size (e.g. 500, 2000). The Case: 04749617 has been created for this issue.

Regarding the NPE error, I could also reproduce the problem with the latest EMA Java 3.0.1.L1 (Elektron SDK 1.0.3) release even in single thread mode.

I will check with the development on both issues and will provide you with more update on this.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
1.9k 6 9 16

To @Raven and all,

This issue has been fixed in the latest version: EMA Java 3.0.3.L1 (Elektron-SDK1.0.7.Java).

Elektron SDK - Java

Please check out of it and hope this helps.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
1 0 0 0

NullPointerException is a RuntimeException . Runtime exceptions are critical and cannot be caught at compile time. They crash the program at run time if they are not handled properly. When a class is instantiated, its object is stored in computer memory. The NullPointerExceptions occur when you try to use a reference that points to no location in memory (null) as though it were referencing an object. These include:

  1. Calling the instance method of a null object.
  2. Accessing or modifying the field of a null object.
  3. Throwing null as if it were a Throwable value.

More about.....NullPointerException

Anto

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea