-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Description
Hi nlohmann,
Don't know if anyone has encountered this issue before, and I am not sure if it is and issue with the library.
I just create a json object, and dump it, publish the result to redis, whenever I receive a message from a TCP socket. However, after running for 15-30 mins, I have a memory error.
The code is very simple:
json jud=json::object();
string timenow = currentTimeStr();
jud["Msg_seq"]=epochTimeStr();
jud["Time"]=timenow;
jud["TimeArrive"]=timenow;
jud["Exchange"]="IB";
jud["Symbol"]="USD_JPY";
string judstr = jud.dump();
redis_cli_.publish("UPDATEx|USD_JPY.IB", judstr, [](cpp_redis::reply &reply) {
//std::cout << "publish UPDATE: " << reply << std::endl;
});
The error:
free(): invalid next size (fast)
Thread 1 "TWS_Client" received signal SIGABRT, Aborted.
0x00007ffff72abae0 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install libgcc-7.3.1-6.amzn2.0.4.x86_64 libstdc++-7.3.1-6.amzn2.0.4.x86_64
(gdb)
(gdb) bt
#0 0x00007ffff72abae0 in raise () from /lib64/libc.so.6
#1 0x00007ffff72acf88 in abort () from /lib64/libc.so.6
#2 0x00007ffff72ebb94 in __libc_message () from /lib64/libc.so.6
#3 0x00007ffff72f180a in malloc_printerr () from /lib64/libc.so.6
#4 0x00007ffff72f330b in _int_free () from /lib64/libc.so.6
#5 0x0000555555587e60 in void __gnu_cxx::new_allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >::destroy<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) ()
#6 0x00005555555847ea in void std::allocator_traits<std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >::destroy<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >(std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >) ()
#7 0x000055555558032a in nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>::json_value::destroy(nlohmann::detail::value_t) ()
#8 0x000055555557c96b in nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>::~basic_json() ()
#9 0x000055555558024f in nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>::json_value::destroy(nlohmann::detail::value_t) ()
#10 0x000055555557c96b in nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>::~basic_json() ()
#11 0x0000555555572d3c in TestCppClient::updateMktDepth(long, int, int, int, double, int) ()
#12 0x00005555555c3bb1 in EDecoder::processMarketDepthMsg(char const*, char const*) ()
#13 0x00005555555cb881 in EDecoder::parseAndProcessMsg(char const*&, char const*) ()
#14 0x00005555555e213c in EReader::processMsgs() ()
#15 0x00005555555657b7 in TestCppClient::processMessages() ()
#16 0x000055555559fb1e in main ()
Describe which system (OS, compiler) you are using.
Virtualbox, Ubuntu 18.04, x86_64 , gc 7.4.0
Describe which version of the library you are using (release version, develop branch).
master branch, version 3.7.3