question

Upvotes
Accepted
5 0 1 2

EMA ommconsumer uninitialize() not working causing memory leak in Java

The flow of our application is:

  1. create OmmConsumerConfig
  2. pass config to newly created OmmConsumer
  3. register interest, get the required data and unregister
  4. finally we uninitialize()

The problem we are seeing is that the connection is not closed. Every time the app runs it creates a new connection. This is causing high CPU load and memory leak.

elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-apiOMM
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
Accepted
25.3k 87 12 25

Hi @anshul.gupta2

Can you confirm which version of the EMA Java API you are using? The latest version of 1.5.0.L1 is available here.

Also, are you able to recreate by taking one of our basic examples and making minimal modifications to implement the above usage scenario?

In addition to the above, the key thing I should point out is that the above usage scenario is far from optimal.

When you create an OmmConsumer and pass the config etc, there is a lot of background process taking place e.g. connect + login to server, download directory of services, download dictionary (or load local) etc - all of which takes time and places a potentially unnecessary burden on your resources.

The recommended approach would be to create the OmmConsumer once and continue to use that same instance to consume data as often and whenever required.

Note that if you are making Snapshot request i.e.RefreshMsg only and not interested in Updates, then you can use Snapshot mode - so that the API unregisters each instrument for you automatically once it has responded with the RefreshMsg (or closed StatusMsg for invalid requests).

consumer.registerClient(reqMsg.serviceName("DIRECT_FEED").name("IBM.N")
.interestAfterRefresh(false), appClient);

However, if your particular implementation requires you to create, register and uninitialize then please respond with a simple application which demonstrates your implementation and the problem - so we can recreate and report to the development as appropriate.


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.

Thanks, updating to latest version has fixed the issue.

Upvotes
3 1 3 3

what will be the case for DACS enabled servies, the OmmConsumer is created with the DACS user name, for a different user a different OmmConsumer instance is created as the username is passed to the connection config, if we have a long running process or application that is serving multiple users the issue with the connection kept open will result in memory leak andconsumers being stuck in memory, and only become dirty when the java application exits.

And this is the case when we have batch-view for multiple instruments and an open stream.

Then for each OmmConsumer a Login handle is needed to mapped and stored with the consumer and when no clients are retrieveing stream, unregister the login handle

And also manage the stream update handle to close the individual streams that end up being created by the batch view.

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.