question

Upvotes
Accepted
646 6 13 25

where can I find a sample of TibMsg::PrintTib usage

question in the title

treprfarfa-api
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.

Upvotes
Accepted
646 6 13 25

I think I know what's happening.. I do delete[] buff and this is probably what cause an exception. This will happen only if PrintTib deletes buffer in the body of the function. Is it possible to confirm?

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.

@igorg

I would try with malloc ( no delete[]) and see if it removes the issue for you. Worked for me, but there may be various tricky factors.

If it does, then you can also try char buffer, with and without delete...

if I do not delete, it does not crash, but it leaks the memory. If I do delete, it crashes with some buffer sizes.

malloc requires 'free' , otherwise it will be memory leak again

or maybe in some cases you override null character of the buffer and my delete[] gets confused.

I will use different approach for the buffer and test it on Monday since the market is closed already.

Thanks

Show more comments
Upvotes
23k 22 9 14

Hello @igorg,

In my RFA 7.6 SDK installation, in folder Legacy/Docs, there is TibMsg Programmer Guide

That contains the method declaration and the example of use:

TibMsg msg;
msg.PrintTib(stdout);

Note, that at the time of the general release of RFA 7.6, in 2014, TibMsg was already best-described as "legacy". Elektron SDK APIs, EMA and ETA are the best choice for new development, if you are looking at a sizable enhancement requirement, it is likely a good point of time to migrate the app to Elektron API.

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.

Could you give me a link where I can download or view RFA 7.6 documentation? I have Docs and Examples from 7.6.2.E3 and I couldn't find anything about TibMsg.

/Legacy/Docs/refman/rfa/classes.html - has nothing about TibMsg as well.

I know about Elekton, however we use RFA in old existing project that is not going to be abandoned soon.

@igorg,

Download the complete older SDK from RFA Downloads at the very bottom.

Upvotes
646 6 13 25

This crashes

static size_t s = 6000; // crashes with bigger size (???)
char* buff = new char[s];
string content(tMsg.PrintTib(buff, s));

if I use s = 5000. It works fine. Could you check if there is a bug in PrintTib function?

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.

Upvotes
23k 22 9 14

Hello @igorg,

Personally, I doubt that there can be a bug in RFA in PrintTib, considering how old the API is, how widely used it was for many years, and how any issue, that could be found during the years of active support, was reported by clients and fixed by us.

Two things that I would do:

1. Make sure you are on the version of API 7.6.2, the only version that includes market data support (TibMsg) and is still currently supported by Refinitiv. This version also incorporates all the fixes to the issues reported prior to it.

2. Try printing your message to the output

msg.PrintTib(stdout);

to see, if you can detect, if something is wrong with the message itself.

Failing this, and if you are on 7.6.2 supported version, you, as a customer, have an option report a suspected issue with a supported version of an API via Refinitiv Helpdesk, choosing Product -> RFA C++, and have it investigated in detail.



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. Yes, we use 7.6.2. I can see version 7.6.2.1 on RFA7_Common140.dll file.

2. Print to the file works fine. Print to the buffer throws.

I will post this issue via Helpdesk and see what they say.

Thanks


Upvotes
646 6 13 25

Ok, I create new case with HelpDesk. They sent me to Developers portal.

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.

Upvotes
7.6k 15 6 9

@igorg

I have tested your sample codes with our example RFASTTicker from 7.6.2.L1 package but still not found the issue.

I have modified MarketDataClient::processDataFromMarketDataEvent from Client.cpp to print the std::string created by your codes.

void MarketDataClient::processDataFromMarketDataEvent(const std::string& serviceName,

const std::string& subject,

const std::string& msgType,

const rfa::sessionLayer::MarketDataItemEvent & MDEvent)

{

TibMsg tMsg;

TibErr err;


_ASSERTE ( MDEvent.getBuffer().c_buf());

tMsg.UnPack( (char *) MDEvent.getBuffer().c_buf() ,MDEvent.getBuffer().size());

static size_t s = 6000; // crashes with bigger size (???)

char* buff = new char[s];

string content(tMsg.PrintTib(buff, s));

cout << "=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================" << endl;

cout << content.c_str() << endl;

//printTibMsg(serviceName,subject,msgType, tMsg );

}


And below is sample output from the RFASTTIcker when testing with currency RIC such as JPY=

=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================

PROD_PERM : INT 4 : 526 <0>

RDNDISPLAY : INT 4 : 153 <0>

DSPLY_NAME : STRING 16 : "DANSKE BANK COP"

TIMACT : STRING 5 : "03:43" <259>

NETCHNG_1 : REAL 8 : -0.53 <18>

HIGH_1 : REAL 8 : 108.62 <18>

LOW_1 : REAL 8 : 108.01 <18>

CURRENCY : STRING 3 : "392" <261>

ACTIV_DATE : STRING 11 : "03 JAN 2020" <258>

OPEN_PRC : REAL 8 : 108.55 <18>

HST_CLOSE : REAL 8 : 108.57 <18>

PREV_DISP : OPAQUE 3 : |@@

ASIA_CL_DT : STRING 11 : "02 JAN 2020" <258>

ASIA_CLOSE : REAL 8 : 108.77 <18>

ASIA_HI_TM : STRING 5 : "23:30" <259>

ASIA_HIGH : REAL 8 : 108.62 <18>

ASIA_LOW : REAL 8 : 108.01 <18>

ASIA_LW_TM : STRING 5 : "02:47" <259>

ASIA_NETCH : REAL 8 : -0.73 <18>

ASIA_OP_TM : STRING 5 : "22:00" <259>

ASIA_OPEN : REAL 8 : 108.55 <18>

EURO_CL_DT : STRING 11 : "02 JAN 2020" <258>

EURO_CLOSE : REAL 8 : 108.42 <18>

EURO_HI_TM : STRING 5 : "10:08" <259>

EURO_HIGH : REAL 8 : 108.86 <18>

EURO_LOW : REAL 8 : 108.22 <18>

EURO_LW_TM : STRING 5 : "15:48" <259>

EURO_NETCH : REAL 8 : -0.23 <18>

EURO_OP_TM : STRING 5 : "06:00" <259>

EURO_OPEN : REAL 8 : 108.73 <18>

US_CL_DT : STRI

=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================

BID : REAL 8 : 108.04 <18>

PRIMACT_1 : REAL 8 : 108.04 <18>

ASK : REAL 8 : 108.05 <18>

SEC_ACT_1 : REAL 8 : 108.05 <18>

VALUE_DT1 : STRING 11 : "03 JAN 2020" <258>

VALUE_TS1 : STRING 8 : "03:43:07" <260>

TIMACT : STRING 5 : "03:43" <259>

NETCHNG_1 : REAL 8 : -0.53 <18>

ACTIV_DATE : STRING 11 : "03 JAN 2020" <258>

ACVOL_1 : REAL 8 : 19767 <0>

PCTCHNG : REAL 8 : -0.49 <18>

BID_NET_CH : REAL 8 : -0.53 <18>

MID_PRICE : REAL 8 : 108.05 <18>

MID_NET_CH : REAL 8 : -0.53 <18>

NUM_BIDS : REAL 8 : 19767 <0>

CTBTR_1 : STRING 12 : "COMM BK KW "

CTB_LOC1 : STRING 3 : "KWI"

CTB_PAGE1 : STRING 4 : "CMBK"

QUOTIM : STRING 8 : "03:43:07" <260>

QUOTE_DATE : STRING 11 : "03 JAN 2020" <258>

QUOTIM_MS : REAL 8 : 13387105 <0>

BIDPCTCHNG : REAL 8 : -0.49 <18>

DSPLY_NAME : STRING 16 : "COMM BK KW KWI"

OFFCL_CODE : STRING 12 : "COMK "

BCKGRNDPAG : STRING 4 : "CMBK"

DLG_CODE1 : STRING 6 : "COMK "

VALUE_TS2 : STRING 8 : "03:43:05" <260>

VALUE_TS3 : STRING 8 : "03:43:05" <260>

ASIA_BNC : REAL 8 : -0.73 <18>


=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================

ASIA_NETCH : REAL 8 : -0.73 <18>


=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================

PCTCHG_3M : REAL 8 : 1.07 <18>

PCTCHG_6M : REAL 8 : 0.2 <18>

PCTCHG_MTD : REAL 8 : -0.75 <18>

PCTCHG_YTD : REAL 8 : -0.75 <18>


=================== processDataFromMarketDataEvent call tMsg.PrintTIb() =================

BID_NET_CH : REAL 8 : -0.53 <18>

IRGPRC : REAL 8 : -0.49 <18>


-Can you try the codes with our example RFASTTIcker and then compare the result with your app?


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.

thanks for your response.

Unfortunately, it's not easy to run the sample code in our environment..

In any case, I've checked your code and it basically does the same what I do.

Could you check your sample with AMXL.MX or CEMEXCPO.MX? I did a couple more tests.. with buffer size equals to 5650 it works fine. With 5800 , it throws when I receive first msg with the snapshot.

Upvotes
23k 22 9 14

Hello @igorg,

I think dynamically allocating memory in the callback, and then deallocating when you don't need it anymore, may be a better option, give it a try?

Same as @moragodkrit, I have tested with RFASTTicker example ( am on win10, VS2019, shared lib)

In processDataFromMarketDataEvent I used almost the same code, tested IBM.N and AMXL.MX

tMsg.UnPack( (char *) MDEvent.getBuffer().c_buf() ,MDEvent.getBuffer().size());

cout << "=================== processDataFromMarketDataEvent before call tMsg.PrintTIb() =================" << endl;

static size_t s = 10000;
char* buff = (char *)malloc(sizeof(char) * (s + 1))
string content(tMsg.PrintTib(buff, s));

cout << "=================== processDataFromMarketDataEvent after call tMsg.PrintTIb() =================" << endl
cout << content.c_str() << endl;

No issue with any buffer size, tested 5000, 6000, 10000.

No crush same as Moragodkrit, see the updates.

=================== processDataFromMarketDataEvent before call tMsg.PrintTIb() =================
=================== processDataFromMarketDataEvent after call tMsg.PrintTIb() =================
ASK            : REAL      8 : 15.37 <19>
SEQNUM         : REAL      8 : 7083217 <0>
QUOTIM_NS      : REAL      8 : 70326 <0>
ASKSIZE        : REAL      8 : 33866 <0>
SEQNUM_QT      : REAL      8 : 7083217 <0>
NA_MSG_TYP     : STRING    1 : "O"
SALTIM         : STRING    8 : "19:32:06" <260>
ASK_TIM_NS     : REAL      8 : 70326 <0>
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.

Hello @zoya.farberov, I'm not sure what you mean by dynamically allocating memory.

This is exactly what I do :

char* buff = new char[s]; - allocating

Printing...

delete[] buff; - deleting.

I just ran a couple more tests on LABB.MX. s = 6000 crashes, but s = 60000 does not. This happens on first message when it's big, around 10000+ characters.

Btw, we use lib to link with our app, not dll.

Hello @igorg,

There may be differences, in environment, in custom app.

I suggested trying with malloc instead of char buffer init, with all/any sizes,

As this test worked for me and should be easy for you.

static size_t s = 10000;
char* buff = (char *)malloc(sizeof(char) * (s + 1))
string content(tMsg.PrintTib(buff, s));

I have tested with RFASTTicker,


Click below to post an Idea Post Idea