question

Upvotes
Accepted
1 0 0 0

Infinite loop querying refinitiv using EMA

Hello,

We are encountering a problem when using the streaming API to retrieve quotes.

We're using a module that's very similar to your example module (ValueAddObjectsForEMA).

This module uses the EMA library, and we've noticed the following malfunction:

When the refinitiv server we're using is unreachable (due to unavailability or network problems, for example), the program enters an infinite loop in the function below. infinite loop method

Please here a screenshot of the stacktrace.

capture.png

We never get out of the loop, even if communication with the server is re-established. Do you have an idea for a fix on the EMA library side? If so, could you do it in your example module, please? Thank you in advance for your help.

Best regards

#technologyema-api
capture.png (10.3 KiB)
icon clock
10 |1500

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

Hi @mickael.bourdel ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,
AHS

Upvotes
Accepted
22.1k 59 14 21

Hi @mickael.bourdel,

I looked at the sample and tried to see what you are reporting. The sample is working fine - EMA SDK is designed to auto-reconnect to the lost connection and recover all the open subscriptions on behalf of the application; thereby saving all the rudimentary recovery coding overhead in the application.

To test this, I shutdown the ADS which provides the chain data and started the example and restarted the ADS at some point. The sample was able to successfully connect and get the data.

However, if the connection is not established for a long time, the application gets the Login error and terminates:

Feb 01, 2024 1:06:56 PM com.refinitiv.ema.access.OmmBaseImpl handleLoginReqTimeout
SEVERE: loggerMsg
  ClientName: Consumer_1_1
  Severity: Error
  Text:  login failed (timed out after waiting 45000 milliseconds) for localhost:14002)
loggerMsgEnd


Feb 01, 2024 1:06:56 PM com.refinitiv.ema.access.ChannelCallbackClient reactorChannelEventCallback
SEVERE: loggerMsg
  ClientName: ChannelCallbackClient
  Severity: Error
  Text:  Received ChannelDown event on channel Channel_1
    Instance Name Consumer_1_1
    RsslReactor Channel is null
    Error Id 0
    Internal sysError 0
    Error Location Reactor.processWorkerEvent
    Error text Error initializing channel: errorId=-1 text=Connection refused: no further information
loggerMsgEnd


    ERROR - Can't create the OmmConsumer because of the following error: login failed (timed out after waiting 45000 milliseconds) for localhost:14002)
  >>> Exiting the application

You can configure this timeout parameter in the EMAConfig xml file - LoginRequestTimeOut.

icon clock
10 |1500

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

Upvotes
22.1k 59 14 21

Hi @mickael.bourdel,

I can see that you are using the Chain module in the Value Added Example. In the effort to identify where this issue is happening - do you see this problem when you run the example code without modification?

icon clock
10 |1500

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

Hello @Gurpreet,

Thank you for your response,

I've tried the example you asked for, with a slight modification to the way the ommConsumer is created, as follows to match my actual usage.

20503-1706546086700.png

When I run the program under the same conditions as above (server unreachable), I get the following log and it's blocked.

20504-1706546234545.png

And when I try to debug, I get the same behavior as before, I notice that it keeps switching here, and the state always stays at the state "OPENING". On class FlatChainImpl


Thanks again for your help.

Sincerely

20505-1706546816858.png

Here's where it gets stuck, I couldn't put more than two attachments in my comment.

Thanks a lot!

Upvotes
22.1k 59 14 21

Hi @mickael.bourdel,

The infinite loop that you mention is the event dispatch loop - which happens because you have chosen OperationModel.USER_DISPATCH.

What are you expecting from the sample - when the market data servers are not reachable - i.e OMM Consumer is not able to establish a connection to the server?

icon clock
10 |1500

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

Upvotes
1 0 0 0

Hello @Gurpreet,

I expect the sample not to block indefinitely, that at some point it falls into error and move on. Or, if the server can be reached again quickly enough, resume the thread as normal.

Currently, if the server is either unreachable for a short period of time and is queried at that time, we enter a state where we can't get out.

icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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