-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Failing tests on MSVC with VS2019 15.9.13 x64 #1685
Comments
That is strange: we successfully use MSVC 19.16.27030.1 (MSVC 2017) in our build CI: https://ci.appveyor.com/project/nlohmann/json/builds/26132437/job/kxhxdypa7gcpi3ls |
I also find it super strange, I can hardly believe to have "discovered" such an obvious issue that nobody else experienced before. But is there something I can try to investigate? I've run test-regression.exe from cmd and reports a segfault in Can I send my test executable to someone for inspection? |
I'm not using Windows myself, but maybe someone else does. |
FWIW, I have run a quick (well, not so quick) check on my machine:
I tried building four builds - debug ("Debug" in CMake) and release ("Release" in CMake), in MSVC (
Then the Release build with MSVC has passed without any problem. The Debug build timeouts in I did also two tests with VS 2019:
and did get SegFaults in the Debug build, the Release build finishes fine. The failing tests were:
until, again, the timeout in The question is, if the fails are coming from the Debug build, or they are masked in the Release build. @nlohmann, it seems you are building it with x86 version of the compiler, while chances are that most of the people will use it with x64 target/host. |
I run the first failing test ( This is what was logged by the test logger: And this was on the call stack: It is difficult for me to say, if the repeating exceptions at the end are just a consequence of the stack overflow, or if they are causing it. |
For For other errors on x64, they might be caused by stack overflow. Can you increase the stack size as demonstrated in AppVeyvor config and see if that eliminate/reduce the failures? |
Yesterday, Visual Studio got a new version, which apparently also updated a toolchain (compiler) and (possibly) the STL, because I am getting different errors when trying to compile the tests with
I recompiled the There are no longer failing tests, only the
For what concerns the timeout, I believe that running one test for more than 25 minutes (which is the currently set timeout) is not very realistic anyway (because I doubt many will run it that long), so my idea is instead to try to run it in parallel. Unfortunately, the test is written as one monolithic test case, so some work is needed, and I may revisit it, once I have some spare time, because it bothers me to see something running so long on one thread when there are eleven more available doing nothing. The same basically goes for all the other tests which complete in two or three digit times. One comment on So it does seem that there is some other difference between VS 2017 and VS 2019 toolchain and/or STL implementation, which lets the former pass and the latter fail (possibly on stack overflow) on |
Running it parallel would be a neat idea. I'm not sure if it can be break down into several smaller tests, but that is helpful too, especially for the environments that parallelism is limited (e.g. AppVeyor).
I haven't run the tests on VS2019 and since AppVeyor hasn't added support for VS2019 yet I haven't pursued adding it to CI. Nevertheless, it would be great to get insight and make any changes (if necessary) to prepare the project for the latest compilers. |
The full Unicode test is nothing that should be executed all the time. It's only something handy to run if anything is changed in the parser. I would advice against touching the code to parallelize it. |
Well, then, no touching the unicode :). What about touching the other tests (for parallelization)? |
The binary formats tests (CBOR, MessagePack, UBJSON, and BSON) are also a bit slow. Not sure how to parallelize them, though. |
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. |
Actually this is still a problem for us :-( |
@emmenlau Could you post a batch/powershell script and what test output you get? It's difficult from the thread to see what exactly was done. |
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. |
Dear @t-b , sorry for the delay but the issue still persists. I have just verified it again. Can you say what exactly I can do to help? I build the sources from a cygwin bash shell that starts a cmd prompt via the script
And here is the output I see:
The exact same problem is reproduced in our setup with Visual Studio 2019.3 and 2017.9. But I understand that this is not super helpful for you. What can I do to move this forward? Send you the executables? Run with debug output enables? |
@emmenlau Have you tried to increase the stack size? It apparently did help in my case (in Debug build with MSVC). Are your release builds also failing? |
Hi @risa2000 ! No I did not try, for us the Windows build is very "inaccessible" in the CI system cloud so I can not just tweak a Visual Studio parameter. Do you by chance know how I can set the stack size via cmake or directly in the json C++ code? |
Does this seem a reasonable setting for this test?
|
Here is a more detailed error from this test:
|
I get reproducibly a crash with Visual Studio 2019 and 2017 in the last line of
Does this mean anything to you? The exception says (in both Visual Studio versions) something along the lines of
|
The same also with a stack size of 32MB. Is this too low or should it be sufficient? |
@emmenlau For which target (platform) exactly do you build the tests? It is a bit confusing mentioning SIGSEGV, cygwin and MSVC in one row. Can you debug the build elsewhere (if not in the CI environment)? Does only the debug build fails, or also the release build? The error "Unhandled exception..." just means that there was invalid memory access (at the address 0xffff....), but this does not help much diagnosing the problem. 8MB stack was enough for me. But if you are running it in a VM (CI) is it possible there are some other limits, imposed by the environment? |
With ed55414 (Merge pull request #1779 from t-b/avoid-using-glob-in-cmake, 2019-10-09) and
if I do
|
I built the tests the same way as @t-b did:
then run the tests and all passed except the UNICODE test, which I killed. In particular:
|
See also https://ci.appveyor.com/project/nlohmann/json/builds/28104196/job/8q1w2crewioyhipj which is from #1780. |
@t-b I believe the problems were only related to debug builds, while your CI builds a release one. |
@risa2000 Good point. I've added https://ci.appveyor.com/project/nlohmann/json/build/job/bkp1lqcisew79u4k. Let's see how it finishes. |
Do you have Windows development machines available so that I could send you the test files with I'm completely at a loss as to what I may be doing wrong. The lines of the crash do not make much sense with respect to an illegal memory access, because it would be inside a For what its worth, I build my sources with |
FWIW, I have been building successfully an app with JSON lib and xtensor lib without this define. both Debug and Release builds, by using both Could you post your compiler commands? (generated by CMake when run with |
Haha yes I can believe that sounds strange! However its not as uncommon as it may seem, because our CI system executes jobs via
Ok this may be interesting. I just tested I've just also noticed that tests are compiled with
No I don't think so, we have a VirtualBox with 32GB RAM and standard Windows 7 x64 install, there should be sufficient resources even for larger applications. |
As long as you're not using anything that requires xtensor iterator magic, you are fine. See however xtensor-stack/xtensor#1659 (comment) for a discussion of the problem.
Ok let me try that later today :) |
The CI build from #1685 (comment) passed. We are seeing a warning when compiling test-regressions.exe so maybe that is something worth exploring.
|
Any help in debugging this issue is highly appreciated!
Two tests from the test suite exit in segfault, and one test exists in timeout:
Please describe the steps to reproduce the issue. Can you provide a small but working code example?
I execute
ctest
in the build directory.Which compiler and operating system are you using?
I used Microsoft Visual Studio 2017 v15.9.13 together with cmake 3.15.0-rc3 and ninja to build the solution. These tools work well for me with more than 60++ software packages.
Did you use a released version of the library or the version from the
develop
branch?Release version 3.6.1.
The text was updated successfully, but these errors were encountered: