Refinitiv / Real-Time-SDK

Other
184 stars 129 forks source link

Memory issue with JSON decoding #211

Closed andysCaplin closed 11 months ago

andysCaplin commented 1 year ago

Our tests revealed an issue in the library when decoding an incoming JSON message. It looks like the same thing happened twice.

The version in use is

PACKAGE eta3.6.5.G1 rrg VERSION eta3.6.5.1 Thu Aug 25 15:30:29 CST 2022

The details are below

2022/10/07-18:37:28: [INFO] upasrc memory results
[STDERR] 2022/10/07-18:37:28: [ERROR] rto-wss - uninitialised variables (check_memory_errors)
[STDERR] ==11161== Conditional jump or move depends on uninitialised value(s)
[STDERR] ==11161==    at 0x4C2EBB7: __GI___rawmemchr (vg_replace_strmem.c:1423)
[STDERR] ==11161==    by 0x596B5EF: _IO_str_init_static_internal (in /lib64/libc-2.12.so)
[STDERR] ==11161==    by 0x595F594: vsscanf (in /lib64/libc-2.12.so)
[STDERR] ==11161==    by 0x5959607: sscanf (in /lib64/libc-2.12.so)
[STDERR] ==11161==    by 0xD4F256: jsonToRwfBase::processAsciiString(jsmntok_t**, RwfBuffer**, void**) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD62FE0: jsonToRwfSimple::processFieldList(jsmntok_t**, void*) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD63E6B: jsonToRwfSimple::encodeMsgPayload(RsslMsg*, jsmntok_t*) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD4FD22: jsonToRwfBase::encodeRsslMsg(RsslMsg*, jsmntok_t**, jsmntok_t*, jsmntok_t*, jsmntok_t*) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD6A239: jsonToRwfSimple::processMessage(jsmntok_t**, RsslJsonMsg*) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD4F57F: jsonToRwfBase::decodeJsonMsg(RsslJsonMsg&) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD0232E: rsslDecodeJsonMsg (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xC7C531: _reactorDispatchFromChannel (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xC7D09B: rsslReactorDispatch (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0x84A56E: process_upa_event (upa.c:1287)
[STDERR] ==11161==    by 0x8B1FE1: loop_events (event_poll.c:438)
[STDERR] ==11161==    by 0x8B21D9: event_poll_loop (event_poll.c:547)
[STDERR] ==11161==    by 0x84F813: upa_thread_start (upa.c:650)
[STDERR] ==11161==    by 0x5246AA0: start_thread (in /lib64/libpthread-2.12.so)
[STDERR] ==11161==    by 0x59DEC4C: clone (in /lib64/libc-2.12.so)
[STDERR] ==11161==  Uninitialised value was created by a heap allocation
[STDERR] ==11161==    at 0x4C297EC: malloc (vg_replace_malloc.c:308)
[STDERR] ==11161==    by 0xD4B4B7: rtr_smplcIntAllocD (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD411AF: rwsWaitResponseHandshake (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD1921D: ipcIntSessInit (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD19F56: ipcSessionInit (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD1A052: rsslSocketInitChannel (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xCFB70D: rsslInitChannel (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xC899AD: runReactorWorker (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0x5246AA0: start_thread (in /lib64/libpthread-2.12.so)
[STDERR] ==11161==    by 0x59DEC4C: clone (in /lib64/libc-2.12.so)
[STDERR] ==11161==
[STDERR] {
[STDERR] <insert_a_suppression_name_here>
[STDERR] Memcheck:Cond
[STDERR] fun:__GI___rawmemchr
[STDERR] fun:_IO_str_init_static_internal
[STDERR] fun:vsscanf
[STDERR] fun:sscanf
[STDERR] fun:_ZN13jsonToRwfBase18processAsciiStringEPP9jsmntok_tPP9RwfBufferPPv
[STDERR] fun:_ZN15jsonToRwfSimple16processFieldListEPP9jsmntok_tPv
[STDERR] --
[STDERR] ==11161== Conditional jump or move depends on uninitialised value(s)
[STDERR] ==11161==    at 0x4C2EBB7: __GI___rawmemchr (vg_replace_strmem.c:1423)
[STDERR] ==11161==    by 0x596B5EF: _IO_str_init_static_internal (in /lib64/libc-2.12.so)
[STDERR] ==11161==    by 0x595F594: vsscanf (in /lib64/libc-2.12.so)
[STDERR] ==11161==    by 0x5959607: sscanf (in /lib64/libc-2.12.so)
[STDERR] ==11161==    by 0xD4F256: jsonToRwfBase::processAsciiString(jsmntok_t**, RwfBuffer**, void**) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD62FE0: jsonToRwfSimple::processFieldList(jsmntok_t**, void*) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD63E6B: jsonToRwfSimple::encodeMsgPayload(RsslMsg*, jsmntok_t*) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD4FD22: jsonToRwfBase::encodeRsslMsg(RsslMsg*, jsmntok_t**, jsmntok_t*, jsmntok_t*, jsmntok_t*) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD6A239: jsonToRwfSimple::processMessage(jsmntok_t**, RsslJsonMsg*) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD4F57F: jsonToRwfBase::decodeJsonMsg(RsslJsonMsg&) (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD0232E: rsslDecodeJsonMsg (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xC7C531: _reactorDispatchFromChannel (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xC7D09B: rsslReactorDispatch (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0x84A56E: process_upa_event (upa.c:1287)
[STDERR] ==11161==    by 0x8B1FE1: loop_events (event_poll.c:438)
[STDERR] ==11161==    by 0x8B21D9: event_poll_loop (event_poll.c:547)
[STDERR] ==11161==    by 0x84F813: upa_thread_start (upa.c:650)
[STDERR] ==11161==    by 0x5246AA0: start_thread (in /lib64/libpthread-2.12.so)
[STDERR] ==11161==    by 0x59DEC4C: clone (in /lib64/libc-2.12.so)
[STDERR] ==11161==  Uninitialised value was created by a heap allocation
[STDERR] ==11161==    at 0x4C297EC: malloc (vg_replace_malloc.c:308)
[STDERR] ==11161==    by 0xD4B4B7: rtr_smplcIntAllocD (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD411AF: rwsWaitResponseHandshake (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD1921D: ipcIntSessInit (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD19F56: ipcSessionInit (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xD1A052: rsslSocketInitChannel (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xCFB70D: rsslInitChannel (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0xC899AD: runReactorWorker (in /builds/platform/cdev/datasrcs/sslsrc/build/upasrc)
[STDERR] ==11161==    by 0x5246AA0: start_thread (in /lib64/libpthread-2.12.so)
[STDERR] ==11161==    by 0x59DEC4C: clone (in /lib64/libc-2.12.so)
L-Karchevska commented 1 year ago

@andysCaplin Thank you for reporting this issue. An internal JIRA has been created for its investigation.

vlevendel commented 11 months ago

Closing since this was working for Andy with eta3.7.0.L1 rrg