-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
JSON Parsing Freeze Issue on Nintendo Switch #4066
Comments
Can you check in the debugger where the code freezes? |
Debugging on the Nintendo Switch is a bit complicated. Personally, I use Logger::log() statement manually to debug. Can you tell me where in the json.h file I need to debug to help you know what my problem is? |
By the way, I have two doubts. Either the json.h file is problematic, or my heap is not large enough for parse, which could also cause a freeze no? |
From all tests and experiences I think it's not the library... |
After reflection, I think I made a mistake in my code. 🤔🤔🤔 Because when I assign some bytes to my dataStream for example more than 20000 bytes it freezes |
In the file json.h, I added a lot of Logger::log() statements to see where it might be blocking. It appears that the code is blocked at this void: parser(i, cb, allow_exceptions).parse(true, result); which, in turn, is blocked by sax_parse_internal(&sdp); And with sax_parse_internal(&sdp), i got this output :
|
Ok i know why my switch freeze. The CPU Usage of the Core #1 is at 100% So maybe the while(true){} of the sax_parse_internal will never finish |
Description
When i attempting to parse a const char* to JSON with this code "json jsonData = json::parse();", my code freezes and becomes unresponsive.
Reproduction steps
My code :
test.cpp
main.cpp :
Expected vs. actual results
The JSON data I'm trying to parse is 4831 bytes in size.
However, when I use a much smaller JSON file, such as the one in this link: https://willbosstwitchbot.glitch.me/twitch?user=Will_Boss_Gamer, which is only 600 bytes in size, there is no problem and the parsing works correctly.
Error messages
No error is reported. However, I have concluded that this line "json jsonData = json::parse(charData);"
freezes my code, because i noticed that "TEST 3" is not sent thanks to the TCP Logger (Logger::log)
My logs:
Compiler and operating system
gcc version 10.2.1 20210110 (Debian 10.2.1-6)
Library version
json.h version 3.7.3
The text was updated successfully, but these errors were encountered: