question

Upvotes
Accepted
6 3 6 7

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

Upvotes
Accepted
11.7k 57 39 60

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.