question

Upvotes
Accepted
6 2 3 5

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 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
9.7k 49 38 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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea