question

Upvotes
Accepted
46 8 12 16

Trying to open a data stream form within a stream callback causes a deadlock

Using example "3.1.0 - Streaming - MarketPrice" and connecting via Eikon4

Replace the OnRefresh handler with the following code:

.OnRefresh((s,msg) =>
{
    Console.WriteLine(msg);
    using (IStream s_ = DeliveryFactory.CreateStream(new ItemStream.Params().Session(session).Name("CHF=")))
    {    
        s_.Open();    
        Console.WriteLine("IT WORKED"); 
    }
})

The program does not return from s_.Open() and will never print "IT WORKED".

Same result when trying to await an OpenAsync() call.

rdp-apirefinitiv-data-platformerror.netrefinitiv-data-platform-libraries
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.

1 Answer

· Write an Answer
Upvotes
Accepted
19.2k 86 39 63

Hi @martin.grunwald,

Yes, the above code will create a deadlock scenario. Try this:

.OnRefresh(async (s, msg) =>
{
   Console.WriteLine(msg);
   using (IStream s_ = DeliveryFactory.CreateStream(new ItemStream.Params().Session(session).Name("CHF="))
   {
      await s_.OpenAsync();
      Console.WriteLine("IT WORKED");
   }
})


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.