Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valgrind memcheck Illegal instruction when use nlohmann::json::parse #2518

Closed
2 of 5 tasks
aixi opened this issue Dec 10, 2020 · 4 comments
Closed
2 of 5 tasks

valgrind memcheck Illegal instruction when use nlohmann::json::parse #2518

aixi opened this issue Dec 10, 2020 · 4 comments
Labels
kind: bug state: needs more info the author of the issue needs to provide more details

Comments

@aixi
Copy link

aixi commented Dec 10, 2020

I am write a program use nlohmann::json, I found that my program may have memory leak, So I use valgrind to detect
memroy leak.But valgrind crashed because of illegal instructions

What is the issue you have?

Program terminated with signal SIGILL, Illegal instruction.

the following is valgrind core back trace

#0  0x000000000535cd51 in nlohmann::detail::lexer<nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >, nlohmann::detail::iterator_input_adapter<__gnu_cxx::__normal_iterator<char const*, std::string> > >::lexer (this=0x1ffeffe9b8, adapter=..., ignore_comments_=false) at /home/admin/nereus/nereus/third_party/nlohmann/json.hpp:5997
5997          , decimal_point_char(static_cast<char_int_type>(get_decimal_point()))
[Current thread is 1 (LWP 32106)]
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.6-13.el7.x86_64 cyrus-sasl-lib-2.1.26-23.el7.x86_64 expat-2.1.0-12.el7.x86_64 fontconfig-2.13.0-4.3.el7.x86_64 freetype-2.8-14.el7_9.1.x86_64 fribidi-1.0.2-1.el7_7.1.x86_64 glibc-2.17-317.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-50.el7.x86_64 libcom_err-1.42.9-19.el7.x86_64 libcurl-7.29.0-59.el7_9.1.x86_64 libgcc-4.8.5-44.el7.x86_64 libidn-1.28-4.el7.x86_64 libpng-1.5.13-8.el7.x86_64 libselinux-2.5-15.el7.x86_64 libssh2-1.8.0-4.el7.x86_64 libstdc++-4.8.5-44.el7.x86_64 libuuid-2.23.2-65.el7.x86_64 nspr-4.25.0-2.el7_9.x86_64 nss-3.53.1-3.el7_9.x86_64 nss-softokn-freebl-3.53.1-6.el7_9.x86_64 nss-util-3.53.1-1.el7_9.x86_64 openldap-2.4.44-22.el7.x86_64 openssl-libs-1.0.2k-19.el7.x86_64 pcre-8.32-17.el7.x86_64
(gdb) bt
#0  0x000000000535cd51 in nlohmann::detail::lexer<nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >, nlohmann::detail::iterator_input_adapter<__gnu_cxx::__normal_iterator<char const*, std::string> > >::lexer (this=0x1ffeffe9b8, adapter=..., ignore_comments_=false) at /home/admin/nereus/nereus/third_party/nlohmann/json.hpp:5997
#1  0x000000000534d653 in nlohmann::detail::parser<nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >, nlohmann::detail::iterator_input_adapter<__gnu_cxx::__normal_iterator<char const*, std::string> > >::parser(nlohmann::detail::iterator_input_adapter<__gnu_cxx::__normal_iterator<char const*, std::string> >&&, std::function<bool (int, nlohmann::detail::parse_event_t, nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&)>, bool, bool) (this=0x1ffeffe990, adapter=..., cb=...,
    allow_exceptions_=true, skip_comments=false) at /home/admin/nereus/nereus/third_party/nlohmann/json.hpp:10180
#2  0x00000000053422f9 in nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >::parser<nlohmann::detail::iterator_input_adapter<__gnu_cxx::__normal_iterator<char const*, std::string> > >(nlohmann::detail::iterator_input_adapter<__gnu_cxx::__normal_iterator<char const*, std::string> >, std::function<bool (int, nlohmann::detail::parse_event_t, nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&)>, bool, bool) (adapter=..., cb=..., allow_exceptions=true, ignore_comments=false)
    at /home/admin/nereus/nereus/third_party/nlohmann/json.hpp:16692

Please describe the steps to reproduce the issue.

  1. wirte a program use nlohmann::json::parse, compile
  2. valgrind --tool=memcheck --leak-check=full --log-file=valgrind.log ./a.out

Can you provide a small but working code example?

What is the expected behavior?

And what is the actual behavior instead?

Which compiler and operating system are you using?

  • Compiler: gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)
  • Operating system: centos7 in a docker

Which version of the library did you use?

  • latest release version 3.9.1
  • other release - please state the version: ___
  • the develop branch

If you experience a compilation error: can you compile and run the unit tests?

  • yes
  • no - please copy/paste the error message below
@aixi aixi added the kind: bug label Dec 10, 2020
@nlohmann
Copy link
Owner

Can you share the program you executed?

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Dec 10, 2020
@aixi
Copy link
Author

aixi commented Dec 10, 2020

Can you share the program you executed?
Thank you for reply
The program belongs to my company, maybe I can provide you with a program that can reproduce the valgrind bugs and remove other sensitive information, but it will take some time

@SteveGremory
Copy link

i'm facing the same issue now, was this resolved by any chance?

@nlohmann
Copy link
Owner

No, because no code was shared. We run Valgrind and MSAN in the CI, so I doubt there is a memory issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug state: needs more info the author of the issue needs to provide more details
Projects
None yet
Development

No branches or pull requests

3 participants