consumer.registerClient

Is it ok to call consumer.registerClient() with batch inputs and also multiple registerClient() for individual rics.

Currently when I call consumer.uninitialize() after everything is processed, the job hangs at the call of consumer uninitialize() and stays like that forever.

Can you please advise?

Best Answer

  • jim.carroll
    Answer ✓

    @sagar.s,

    That callstack looks very similar to an issue that was recently fixed. The fix is available on GitHub under the tag Elektron-SDK_1.2.0.2.G1, and is available in Maven Central (version 3.2.0.2). Would you be able to upgrade to this release?

«1

Answers

  • Hi,

    could you please provide the jstack (thread dump) of your process when it hangs in the consumer.uninitialize() method call?

    Thanks,
    Michal

    $JAVA_HOME/bin/jstack <process_id> 
  • Please find the attached thread dump.

    test-thread-print1.txt

  • Any updates on this ?

  • Hello @sagar.s,

    There is no issue to register batch and multiple single requests. It is straightforward to verify on your side. I took example 370, MarketPrice Batch, that came with SDK, and after batch request, introdruced single requests for the same instruments (the duplicates are tested on purpose, as I think it is part of yoru question), the resulting code looking like this:

    ...
    OmmArray array = EmaFactory.createOmmArray();

    array.add(EmaFactory.createOmmArrayEntry().ascii("TRI.N"));
    array.add(EmaFactory.createOmmArrayEntry().ascii("IBM.N"));

    batch.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, array));

    consumer.registerClient(EmaFactory.createReqMsg().serviceName("ELEKTRON_EDGE").payload(batch), appClient);

    ReqMsg reqMsg = EmaFactory.createReqMsg();
    consumer.registerClient(reqMsg.serviceName("ELEKTRON_EDGE").name("IBM.N"), appClient);
    consumer.registerClient(reqMsg.serviceName("ELEKTRON_EDGE").name("IBM.N"), appClient);
    consumer.registerClient(reqMsg.serviceName("ELEKTRON_EDGE").name("TRI.N"), appClient);

    Thread.sleep(60000); // API calls onRefreshMsg(), onUpdateMsg() and onStatusMsg()

    ...

    Please observe that there is no issue when the example uninitializes after 60 seconds, all the 5 items requests are closed:

    Item Name: TRI.N
    Service Name: ELEKTRON_EDGE
    Item State: Closed / Suspect / None / 'Login stream was closed.'

    Item Name: TRI.N
    Service Name: ELEKTRON_EDGE
    Item State: Closed / Suspect / None / 'Login stream was closed.'

    Item Name: IBM.N
    Service Name: ELEKTRON_EDGE
    Item State: Closed / Suspect / None / 'Login stream was closed.'

    Item Name: IBM.N
    Service Name: ELEKTRON_EDGE
    Item State: Closed / Suspect / None / 'Login stream was closed.'

    Item Name: IBM.N
    Service Name: ELEKTRON_EDGE
    Item State: Closed / Suspect / None / 'Login stream was closed.'

    Therefore, I believe the issue that causes the hang is elsewhere in your application, threading and synchronization design can be challenging. If you see hang on unintialization I would look into threading and synchronization.

    If you find that you are unable to zero in on the exact issue you are facing by "dressing down" your app code, and that you need someone to take a detailed look at the code, and your organization is a TRDC member, your option is creating a TRDC inquiry, attaching your custom code, and getting time-sensitive in-depth help on your code.

  • @zoya.farberov/ @jim.carroll

    Lets say I have registered to 200 RICs using batch and also by individual RIC. So when I call consumer.uninitialize(), should I receive a msg for ALL 200 RIC saying the RIC state is closed everytime?

    Eg:

    Item Name: TRI.N Service Name: ELEKTRON_EDGE Item State: Closed / Suspect / None / 'Login stream was closed.'

    @jim.carroll

    Can you please provide more info on the callstack issue such as root cause or any other info if you are aware?

    Thanks,

    Sagar

  • Hi @sagar.s,

    Yes, you should see them if you log everything as in the example,

    .However, we suggest that:

    • An application unregisters any item interest that is not required anymore via unregister call
    • Logging level is chosen appropriately for the app to be efficient
  • @jim.carroll

    I do not see RIC state closed after I call uninitialize(). I only see the folllowing:

    May 31, 2018 5:07:30 PM com.thomsonreuters.ema.access.ChannelDictionary processCallback
    WARNING: loggerMsg
    ClientName: ChannelDictionary
    Severity: Warning
    Text: RDMDictionary stream was closed with status message
    streamId 3
    Reason State: Closed/Suspect/None - text: "Login stream was closed."
    loggerMsgEnd
    May 31, 2018 5:07:30 PM com.thomsonreuters.ema.access.ChannelDictionary processCallback
    WARNING: loggerMsg
    ClientName: ChannelDictionary
    Severity: Warning
    Text: RDMDictionary stream was closed with status message
    streamId 4
    Reason State: Closed/Suspect/None - text: "Login stream was closed."
    loggerMsgEnd
  • FYI... I'm using the 1.1.E1 version of EMA

  • Hello @sagar.s ,

    Were you able to upgrade to the latest version 1.2 as suggested by Jim?

    I have tested with Elektron-SDK1.1.0.java.rrg, it is a general release version of 1.1, not the latest, "E" stands for "early release".

    Were you able to run modified Batch example, did you see the expected number of "item close"?

  • Hi @zoya.farberov

    1. I have requested for upgrade to new version.

    2. I ran the modified batch call, still I do not see the items close. Is there any setting that needs to be added in EmaConfig.xml?

  • Hi @sagar.s ,

    No special settings should be necessary. If you run MarketPrice example 100 unmodified, till it exists, do you see in your output, toward the end:


    StatusMsg

    streamId="5"

    domain="MarketPrice Domain"

    state="Closed / Suspect / None / 'Login stream was closed.'"

    name="IBM.N"

    serviceId="300"

    serviceName="ELEKTRON_EDGE"

    StatusMsgEnd

  • @zoya.farberov

    is there a way to enable debugging statements for EMA

  • @sagar.s

    For library logging, EMA uses SL4J, so you can adjust and direct EMA logging this way:

    sl4j info

    For application-related logging, such as Status event, the application is completely in control on how and what to log.

    If you run unmodified MarketPrice 100 example, what last 20 lines do you see logged upon exit?

    As you are facing the issue, I am trying to understand where the difference (not seeing the output) first manifests, if you see the output from the standard examples as expected.

  • @sagar.s ,

    Please confirm you have a file named "logging.properties" in \Elektron-SDK\Ema\Src\examples\java folder and it is referenced by the examples by default;

    or if you are passing it on the command line as VM argument, for example:

    -Djava.util.logging.config.file=sagar.properties

    ?

  • @zoya.farberov

    I was able to reproduce the error using an example code. I used the consumer series102 snapshot code. I subscribed to 5 rics as a batch and ran it every 5secs. The example code got stuck at 5:30 pm. In order to reproduce the issue, the server has to be very busy.

  • I was able to reproduce the error using an example code. I used the consumer series102 snapshot code. I subscribed to 5 rics as a batch and ran it every 5secs. The example code got stuck at 5:30 pm. In order to reproduce the issue, the server has to be very busy.

  • Hello @sagar.s,

    Please attach the complete modified example, I will run it and try to reproduce the issue you are seeing on my side.

    If reproduced, I will file the issue with Elektron API product team, it will be prioritized and resolved.

    Use the little "paper clip" tool on top of the answer entry window to attach it.

    Thanks

  • consumer.zip

    @zoya.farberov

    Please find the attached zip file containing Consumer.java modified example code.

    I have redacted the server config,user and service name. Please add it accordingly.

    Linux server version is RHEL 6.7

    Thanks,

    Sagar

  • @sagar.s,

    Received.

    Just to confirm, you are testing with EMA 1.2 now?

  • Yes... EMA 1.2

  • @sagar.s,

    Does uninitialize hang consistently for you with this example?

    or under what conditions?

    I run the example several times so far and was not able to reproduce the hang on unitialize.

  • @sagar.s

    Please provide several Java call stacks of all threads when the application hangs. I would like to verify if it is deadlock.

  • @zoya.farberov @sagar.s

    Hello, I'd like to add related info regarding this issue. Currently, EMAJ 1.2.0 (or below) may encounter a stuck problem when an OMMConsumer.uninitialize() method is called. This is similar to a deadlock problem, but it is not.

    To elaborate on this problem, when the application calls that method, it holds a lock object and waits (TIMED_WAITING) for a Worker thread pool termination condition. However, the thread pool (EMA thread) waits for the lock object and entered to WAITING state.

    Now, I'm checking whether the resolution has been released on GitHub already or not.

  • @sagar.s Anyway, if you can obtain the thread dump when the application encounters this issue, please attach it to me for analysis whether this is the same issue or not.

    So, I recommend you capture a thread dump from the following command:

    // List all Java processes
    $jps

    // Get the Java Stack Trace / Thread Dump
    $jstack -l <processId>

    Note that you can redirect a result from jstack to a file using a right angle bracket character. For example:

    $jstack -l 9608 > c:\Users\u0154418\Desktop\test_jstack.txt

    Hope this helps.

  • @Nipat Kunvutipongsak,

    Yes, the fix for the issue you describe was released on GitHub in tag Elektron-SDK_1.2.0.2.G1. I believe it to be the same issue as the one in this question, based on a thread dump that was provided earlier in the comments.

  • @jim.carroll /

    @Nipat Kunvutipongsak,

    Is the version

    released on GitHub in tag Elektron-SDK_1.2.0.2.G1

    is same as ESDK SDK - Java - 1.2.0 67.44 MB 04/27/2018 17:26 in

    https://developers.thomsonreuters.com/elektron/elektron-sdk-java/downloads link ? If not, can it be made available in above link?

  • Hello @sagar.s ,

    I do not believe the version in the Elektron->Downloads is the same, as the version on GitHub. Github includes all the latest fixes. General release download was updated on 04/27 while GitHub was last updated 13 days ago.

    Are you able to download the latest from github? If not, I can share it with you using sendthisfile download link.

    The Downloads link should be updated with the next general release version.

  • @zoya.farberov

    Any eta for the next general release?

    We are only allowed to download from the link

    https://developers.thomsonreuters.com/elektron/elektron-sdk-java/downloads

    Please provide the sendthisfile link as well. I'll check if its allowed for download.

  • threadprint-20180613.txt

    @Nipat Kunvutipongsak / @zoya.farberov / @jim.carroll /

    @jirapongse.phuriphanvichai

    Please find the requested info:

    jps
    26778 Jps
    22540 Consumer


    jcmd -l 22540
    27018 sun.tools.jcmd.JCmd -l 22540
    22540 com.thomsonreuters.ema.examples.training.consumer.series100.example102__MarketPrice__Snapshot.Consumer

    jcmd 22540 Thread.print > Thread.print_20180613.txt
    ps -efL | grep -i consumer > process_list.txt