Port not closed after destroying OmmProvider
It seems that when the OmmProvider destructor is called, the server port is not closed properly. This causes some issues for us since we in the same process need to destroy and create the provider multiple times.
Example code:
#include <iostream>
#include <chrono>
#include <ctime>
#include <thread>
#include "Ema.h"
using namespace refinitiv::ema::access;
using namespace refinitiv::ema::rdm;
class Gateway : public refinitiv::ema::access::OmmProviderClient
{
public:
Gateway() : m_provider(OmmIProviderConfig("<insert EMA config file path here>"), *this) {}
~Gateway() { std::cout << "~Gateway()" << std::endl; }
OmmProvider m_provider;
void onReqMsg(
const refinitiv::ema::access::ReqMsg &reqMsg,
const refinitiv::ema::access::OmmProviderEvent &handle)
{
if (reqMsg.getDomainType() == MMT_LOGIN)
{
m_provider.submit(
RefreshMsg().
domainType(MMT_LOGIN).
name(reqMsg.getName()).
nameType(USER_NAME).complete().
attrib(ElementList().complete()).
solicited(true).
state(OmmState::OpenEnum, OmmState::OkEnum, OmmState::NoneEnum, "Login accepted"),
handle.getHandle());
}
}
void onClose(
const refinitiv::ema::access::ReqMsg &msg,
const refinitiv::ema::access::OmmProviderEvent &handle)
{
}
};
int main(void)
{
for (int i = 0; i < 5; i++)
{
std::cout << "Creating gateway..." << std::endl;
try {
Gateway gwy;
} catch (const OmmException & excp) {
std::cerr << excp << std::endl;
return 1;
}
std::this_thread::sleep_for (std::chrono::seconds(1));
}
return 0;
}
Output:
[tbricks@lsp7037c Ema]$ /tmp/provider
Creating gateway...
~Gateway()
Creating gateway...
Exception Type='OmmInvalidUsageException', Text='Failed to initialize OmmServerBaseImpl (Unable to bind RSSL server).' Error Id='-1' Internal sysError='98' Error Location='' Error Text='</local/jenkins/workspace/ESDKCore_RCDEV/OS/RH6-64/rcdev/source/rtsdk/Cpp-C/Eta/Impl/Transport/ripcutils.c:1183> Error: 1002 Unable to bind socket. System errno: (98)
'. ', ErrorCode='-1'
[tbricks@lsp7037c Ema]$ uname -a
Linux lsp7037c.XXXX.se 3.10.0-1160.53.1.el7.x86_64 #1 SMP Thu Dec 16 10:19:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
We are using libema-2.0.0.so
Best Answer
-
I found that this issue has been fixed in RTSDK 2.0.6.L1.
EMA C++ 3.6.6.L1 Issues Resolved
- [RTSDK-1486] - Fix to EMA examples to account for MapEntry key which can be Buffer, Ascii or Rmtes
- [RTSDK-6099] - Port is not released after destroying OMMProvider [GitHub #192]
- [RTSDK-6125] - Ensure that LibcurlName can be specified via programmatic config (removed from file config)
- [RTSDK-6150] - EMA_Config Guide shows duplicate definitions: NumberOfLogFiles, Filename, etc
- [RTSDK-6168] - InitializationTimeout does not take effect via programmatic config [GitHub #196]
- [RTSDK-6302] - EMAC++'s default Login request does not have the correct position on Windows
- [RTSDK-6290] - Cons470 Segmentation fault when connect to server doesn't support warmstandby and Ctrl+C
2
Answers
-
Hello @Martin Hallerdal ,
To verify, I have tried running your code as is. I am running with the latest RTSDK 2.0.4.
The only modification was config
Gateway() : m_provider(OmmIProviderConfig().port("14002"), *this) {}
My result:
Creating gateway...
~Gateway()
Creating gateway...
~Gateway()
Creating gateway...
~Gateway()
Creating gateway...
~Gateway()
Creating gateway...
~Gateway()
C:\Real-Time-SDK-20220103\Cpp-C\Ema\Executables\WIN_64_VS142\Debug_MDd\IProv100.exe (process 43768) exited with code 0.
Press any key to close this window . . .-so I did not reproduce this issue.
I have also looped the simple provider example IProvider 100 that came with SDK:
int main()
{
for (int j = 0; j < 5; j++) {
cout << endl << "Iteration: "<< j << " coming in..." << endl;
try
{
AppClient appClient;
OmmProvider provider(OmmIProviderConfig().port("14002"), appClient);
while (itemHandle == 0) sleep(1000);
for (Int32 i = 0; i < 10/*60*/; i++)
{
provider.submit(UpdateMsg().payload(FieldList().
addReal(22, 3391 + i, OmmReal::ExponentNeg2Enum).
addReal(30, 10 + i, OmmReal::Exponent0Enum).
complete()), itemHandle);
sleep(1000);
}
}
catch (const OmmException& excp)
{
cout << excp << endl;
itemHandle = 0;
}
cout << endl << "Iteration: " << j << " coming out..." << endl;
}
return 0;
}Connecting Consumer100 example to it and consuming the test data. I did not reproduce the port bind issue either.
I have looked through RTSDK 2.0.4 changelog for relevant fixes, the only similar fix:
" [RTSDK-4249] - Provider and VAProvider cannot bind port if setting compressionType to LZ4 when setting subprotocol"
is listed as fixed in version 1.5.1, prior to version 2.0.0, you should have it.
This may be local to the environment? Another process could be binding to the same port?
I would try to retest with a different, unused port, and if possible, rebuild with the latest RTSDK 2.0.4, to make sure you benefit from all the latest fixes and improvements.
0 -
Hello @Martin Hallerdal ,
Consequently, I have had a chance to run the same tests, with RTSDK 2.0.0 and 2.0.4 EMA on Linux, and I see what appears to be the same sys error "Unable to bind socket".
I have referred your report to RTSDK development team to verify:
https://github.com/Refinitiv/Real-Time-SDK/issues/192
and will update in this thread once we have further information to share
3 -
Many thanks Zoya0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛