jsoncpp icon indicating copy to clipboard operation
jsoncpp copied to clipboard

Segfault on construction of class using json in a multi threaded application

Open Levi-Armstrong opened this issue 6 years ago • 4 comments

Describe the bug Segfault on construction of class using json in a multi threaded application.

gdb output:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007fffe99a535f in ?? () from /usr/lib/x86_64-linux-gnu/libjsoncpp.so.1
(gdb) bt
#0  0x00007fffe99a535f in ?? () from /usr/lib/x86_64-linux-gnu/libjsoncpp.so.1
#1  0x00007ffff7de5733 in call_init (env=0x7fffffffd3e8, argv=0x7fffffffd3d8, argc=1, l=<optimized out>) at dl-init.c:72
#2  _dl_init (main_map=0x7ffff7ffe170, argc=1, argv=0x7fffffffd3d8, env=0x7fffffffd3e8) at dl-init.c:119
#3  0x00007ffff7dd60ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#4  0x0000000000000001 in ?? ()
#5  0x00007fffffffd7eb in ?? ()
#6  0x0000000000000000 in ?? ()

If I remove the following lines of code the issue goes away.

#if JSON_USE_NULLREF
// for backwards compatibility, we'll leave these global references around, but
// DO NOT use them in JSONCPP library code any more!
// static
Value const& Value::null = Value::nullSingleton();

// static
Value const& Value::nullRef = Value::nullSingleton();
#endif

To Reproduce Steps to reproduce the behavior:

  1. I will work on a test case but I have been able to reproduce on multiple machines.

Desktop (please complete the following information):

  • Ubuntu 18.04.3 LTS
  • Intel® Core™ i7-4700MQ CPU @ 2.40GHz × 8
  • Quadro K1100M/PCIe/SSE2
  • GNOME 3.28.2
  • 64-bit

Levi-Armstrong avatar Nov 24 '19 03:11 Levi-Armstrong