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

ABI issue with json object between 2 shared libraries #813

Closed
ayounes-nviso opened this issue Nov 2, 2017 · 3 comments
Closed

ABI issue with json object between 2 shared libraries #813

ayounes-nviso opened this issue Nov 2, 2017 · 3 comments
Labels
state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Comments

@ayounes-nviso
Copy link

Bug Report

  • What is the issue you have?

Crash somtimes, not always

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?
  1. main application uses 1 shared libraries a.so that uses another library b.so.
  2. "json" object J is instanciated by a.so
  3. J is passed by const reference to b.so
  • What is the expected behavior?

passed json object J can be used throughout b.so

  • And what is the actual behavior instead?

Sometimes it works, sometimes it crashes, ex:

0x00007ffff7b3bd24 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(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> const&) ()

I tried to pass the json object by copy instead but eventually it will crash elsewhere down the road.

gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)

  • Did you use a released version of the library or the version from the develop branch?

develop branch

Feature Request

  • Describe the feature in as much detail as possible.

Right now the only way to work around the issue is to remove json from the shared library interface and just serialize/deserialize with string.

  • Include sample usage where appropriate.
@ayounes-nviso
Copy link
Author

I have the same issue with master branch:

0x00007ffff7b3b034 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(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> const&) ()

@ayounes-nviso
Copy link
Author

It seems that adding a simple print work around this issue:

bool setOptions(const json &options) override {
cout << options << endl;
....
}

@stale
Copy link

stale bot commented Dec 2, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Dec 2, 2017
@stale stale bot closed this as completed Dec 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated
Projects
None yet
Development

No branches or pull requests

1 participant