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

Test #9: test-cbor test case sample.json fails in debug mode - Stack overflow #2955

Closed
2 of 5 tasks
Andreas-Schniertshauer opened this issue Aug 19, 2021 · 10 comments · Fixed by #2961
Closed
2 of 5 tasks
Assignees
Labels
kind: question platform: visual studio related to MSVC release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@Andreas-Schniertshauer
Copy link

What is the issue you have?

9/61 Test  #9: test-cbor ....................................***Failed    3.83 sec
[doctest] doctest version is "2.4.6"
[doctest] run with "--help" for options
===============================================================================
test\src\unit-cbor.cpp(1914):
TEST CASE:  single CBOR roundtrip
  sample.json

test\src\unit-cbor.cpp(1914): FATAL ERROR: test case CRASHED: SIGSEGV - Stack overflow

===============================================================================
test\src\unit-cbor.cpp(1914):
TEST CASE:  single CBOR roundtrip

DEEPEST SUBCASE STACK REACHED (DIFFERENT FROM THE CURRENT ONE):
  sample.json

===============================================================================
[doctest] test cases:       2 |       1 passed | 1 failed | 5 skipped
[doctest] assertions: 1640539 | 1640539 passed | 0 failed |
[doctest] Status: FAILURE!

Please describe the steps to reproduce the issue.

  1. cmake .. -D JSON_Install:BOOL=OFF -D JSON_ImplicitConversions:BOOL=OFF -D JSON_BuildTests:BOOL=ON
  2. cmake --build . --config Debug
  3. ctest -C Debug -LE not_reproducible -LE git_required --output-on-failure

Can you provide a small but working code example?

What is the expected behavior?

Test should not fail in debug mode

And what is the actual behavior instead?

Test fails in debug mode

Which compiler and operating system are you using?

  • Compiler: Visual Studio 2019 16.11.0 Professional
  • Operating system: Windows 10 21H1

Which version of the library did you use?

  • latest release version 3.10.0 (zip file)
  • 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
@nlohmann
Copy link
Owner

Can you please try in release mode and/or with an increased stack depth?

@nlohmann
Copy link
Owner

We're using -DCMAKE_EXE_LINKER_FLAGS="/STACK:4000000" in the CI.

@Andreas-Schniertshauer
Copy link
Author

Can you please try in release mode and/or with an increased stack depth?

Sorry forget to mention in release mode all is fine.

@nlohmann
Copy link
Owner

Alright, this behavior is known. Increasing the stack size should fix it.

@nlohmann nlohmann added kind: question solution: proposed fix a fix for the issue has been proposed and waits for confirmation and removed kind: bug labels Aug 19, 2021
@Andreas-Schniertshauer
Copy link
Author

Thanks, increasing the stack size solved this issue, is it possible to add this to the CMakeLists as standard?

@nlohmann
Copy link
Owner

Thanks, increasing the stack size solved this issue, is it possible to add this to the CMakeLists as standard?

I guess, but I'm not using MSVC myself and I'm not too good with CMake's generator expressions - so if anyone would volunteer, I'd be happy to merge a PR for this.

@nlohmann
Copy link
Owner

@Andreas-Schniertshauer Can you try to add

target_compile_options(test-cbor PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/STACK:4000000;>)

to test/CMakeLists.txt?

@Andreas-Schniertshauer
Copy link
Author

This does not work, it goes to the C/C++/Command Line/Additional Options (because of target_compile_options) instead of the linker section, it must be target_link_options instead of target_compile_options than it works.

@nlohmann
Copy link
Owner

Ah, I meant /F4000000. I want to avoid target_link_options as it requires CMake 3.13.

I created a PR #2961 to set the flags and also adjusted the CI settings accordingly. Please let me know if this works for you.

@nlohmann
Copy link
Owner

I switched back to using a linker flag. The changes seem to work in the CI. I will merge them once AppVeyor has completed the MSVC checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question platform: visual studio related to MSVC release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants