offstream post: Failed to uninitialize OmmBaseImpl

When we do an offstream post, we get:

Text: Failed to uninitialize OmmBaseImpl (_executor.awaitTermination() timed out).

Create OmmConsumer, register login client, post message after refresh, get ack message, call ommConsumerUninitalize ends with the above error.

Best Answer

  • niz
    niz
    Answer ✓

    Thanks for the update.

    The code is based on the offstream post example.

    Post messages are accepted and acknowledged with the ackMsg callback, then after a call to uninitialise is triggered and result in error.

    The code runs in a java application hence a thread is created for the post, so when the uninitialize method is reached there is an active thread.

Answers

  • Hello @niz,

    As you are work with EMA Java, I would like to suggest:

    1. Double-check that your recipient ( is it a custom provider) accepts posts.

    2. In your Refinitiv Realtime SDK -> EMA -> Examples, select simple example 341, MarketPrice OffStream Post, and retest,

    To confirm if by using the example you are able to post successfully and and consumer.uninitialize() without errors. If that works, then next you can modify the working example to implement your custom use case.

  • Hello @niz,

    I hear what you observe and understand the scenario in theory.

    I have run the example several times (MS Win, ESDK 1.5, EMA Java consumr example 341) and was unable to reproduce "Text: Failed to uninitialize OmmBaseImpl (_executor.awaitTermination() timed out)." in uninit.

    Next, I have shortened sleep/run from 60000 to 6000 and to 600, and still I could not reproduce.

    I have also posted to invalid RIC, got a Nack, but still no such error.

    What version of SDK do you test with? Anything special that you do?

    Basically, to try to understand, we would need to be able to reproduce.

  • The code is running in a web application, as an example the post request comes from a web request, that is passed to a Class that has a client implementation in it, and it does post, after the ack is recieved it does uninitialize.

    The REST example that is on refinitiv could be used, extended to accpet a post request.


    The code uses EMA libs 3.5.1.0

  • Hello @niz,

    My understanding now is, that you are able to use EMA postiing example 341, that came with SDK 1.5, to post successfully, and to uninitialize without issues?

    Are you able to provide a minimal example, that we can run to reproduce the issue, or a way, to reproduce it with the standard example from SDK?

    Iif the issue is with Realtime SDK, this will help us to troubleshoot and fix the issue, if the issue is with your custom app, it will help you to get to the bottom of the issue and fix it.

  • testPublish.zip sample example attached.

    Update application.yml with the trep host, and app id.
    Use rest endpoint to post a publish request

    POST: testPublish.ziphost/DACS_USERNAME/SERVICE/INSTRUMENT

  • Hello @niz,

    Thank you. I appreciate that it took time and effort to produce the example.

    I have taken several attempts to import it into my Eclipse, did not go through for me, multiple errors.

    A couple of thoughts:

    Please confirm, that you are not able to reproduce the uninitialization error when running EMA example 341 found with SDK, and only see the error when you initialize and uninitialize via spring?

    Are you on the first version of RSDK, 2.0 or the latest version of ESDK 1.5, or it's one of the earlier versions ( some issue have been fixed since)?

    On the code:

    Uninitialize() should only be called once. it seems that you are posting multiple times, by the number of instruments on the list. Each post should solicit an Ack. That will result in logout() that calls uninitialize(). Please verify, printing is the easiest.

    I would also not call unitialize from ackMessage callback, even if you post only once, and this is the only ack, as some other callbacks, refresh, status, ect., may be received after the ack callback.


    Let us know if this helps?

  • The root cause is threads, as when the publish web request has its own thread executor and the publish request get one of its own by the API, moving the uninitialize to the initializing thread solves the issue

  • Hello @niz,

    For test purposes, I have taken EMA consumer example 341 (single file, no additional threads other then introduced by the library itself)), and tested uninitialize from Ack, same as you have shown in the minimal example code:

    public void onAckMsg(AckMsg ackMsg, OmmConsumerEvent event)
        {
            System.out.println("Received AckMsg. Item Handle: " + event.handle() + " Closure: " + event.closure());
            
            decode( ackMsg );
            
            System.out.println();
            System.out.println("About to uninitialize() in onAckMsg");
            ((OmmConsumer)event.closure()).uninitialize();
            System.out.println("After uninitialize() in onAckMsg");
        }

    It has resulted in the same error that you see, without any additional threads being introduced:

     Text:    Failed to uninitialize OmmBaseImpl (_executor.awaitTermination() ti
    med out).
    loggerMsgEnd

    This is because at the time that ack message is received, after it, there are still messages to be received, status, login closure, etc.

    In the custom consumer, please make sure to receive all the messages, prior to calling uninit, this should be the right approach.

    Let us know how this works for you?