question

Upvotes
Accepted
1 0 0 1

Server socket don't close on OmmProvider destroying.

I want to use an Interactive Provider as a server in my application. An object of OmmProvider is correctly created, configured as IProvider, binds socket and works well with all test Consumer apps, but when it comes to destroying an object and closing socket, it stays binded. So, next time I want to create a new OmmProvider object on this same port, it throws an exception (Error: 1002 Unable to bind socket. System errno: (98)) and can't bind second time. Using ServerSharedSocket=1 config option results in consumers just connecting to the old socket, ignoring a new one. Socket is closed well when the process is killed, but unfortunately, killing process is not an option, an app needs to be up and running all the time. In addition, there is a rsslCloseServer() method mentioned in Eta documentation. I guess this is what I need, but I don't see any way to call it on an Ema level. I cannot see any usages of it in the test examples of Ema either.

Could you please suggest how I can correctly close a OmmProvider's socket on Ema level without killing a process? Maybe there is some Server or Provider configuration option that I am missing?

elektronrefinitiv-realtimeelektron-sdkema-apirrt
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.

Emailed Jirapongse and Chavalit to reply to the last user's post.

@sviatoslav.bakaras

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query? If yes please click the 'Accept' text next to the most appropriate reply.

If you know an answer, please share your answer, and then accept it. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS


Upvotes
Accepted
78.8k 249 52 74

@sviatoslav.bakaras

Thank you for the code.

The problem happens on Linux, but not on Windows.

If you are RDC (Refinitiv Developer Connect) subscriber, you can directly submit this issue to the API support team via Contact Premium Support to verify the problem.

1626318197703.png

Otherwise, you can raise this issue via Refinitiv Real-Time SDK Github.



1626318197703.png (56.7 KiB)
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
78.8k 249 52 74

@sviatoslav.bakaras

I have modified the C++ IProv100 example in the RTSDK-2.0.1.L2.win.rrg (EMA 3.6.1.L2) package to creating a new OmmProvider after deleting the previous one. The code looks like this:

int main()
{
    try
    {
        AppClient appClient;
        while (true) {
            printf("Create OmmProvider\n");
            OmmProvider* provider = new OmmProvider(OmmIProviderConfig().port("14002"), appClient);
            itemHandle = 0;
            while (itemHandle == 0) sleep(1000);


            for (Int32 i = 0; i < 10; i++)
            {
                provider->submit(UpdateMsg().payload(FieldList().
                    addReal(22, 3391 + i, OmmReal::ExponentNeg2Enum).
                    addReal(30, 10 + i, OmmReal::Exponent0Enum).
                    complete()), itemHandle);


                sleep(1000);
            }
            printf("Delete OmmProvider\n");
            delete(provider);
            sleep(5000);
        };
        
    }
    catch ( const OmmException& excp )
    {
        cout << excp << endl;
    }
    
    return 0;
}

From my testing, the application can close and reopen TCP 14002 port properly.

1625203700036.png


1625203700036.png (19.0 KiB)
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
18.2k 21 13 21

Hi @sviatoslav.bakaras

On top of @jirapongse.phuriphanvichai answer, I also tested com.refinitiv.ema.examples.training.iprovider.series100.ex100_MP_Streaming on EMA Java.

And it works fine as well.

ahs1.png



ahs1.png (60.4 KiB)
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
1 0 0 1

@jirapongse.phuriphanvichai @chavalit.jintamalit , thank you for your investigations!

I've also tried to reproduce this issue with a minimal code. Here it is, three simple steps, even without sending anything (modified IProv100):

screenshot-from-2021-07-02-12-56-50.pngCreating a OmmProvider object, destroying it and creating a new one on the same port.

Here is the output:

Creating provider

Deleting provider

Creating provider one more time

Exception Type='OmmInvalidUsageException', Text='Failed to initialize OmmServerBaseImpl (Unable to bind RSSL server).' Error Id='-1' Internal sysError='98' ..........

Worth to mention, I'm running a RHEL7 (Red Hat Enterprise Linux Server release 7.4 (Maipo)) and using Clang 10.0.1 compiler. (Also tried with GCC 4.8.5, but it's all the same).

I've also checked executable's syscalls with "strace" utility. There is a socket creation with "socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)", which returned "10", but there is no "close(10)" call after it to actually close it.

Debugging Ema's code gave no results too. All methods, used in d-tor, returned success code, but still no close(..) called.


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.