-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
cjson memory leak (overload) #1722
Comments
The cjson library makes a lot of assumptions about memory allocations never failing, which we can't fix without pretty much rewriting the whole library. We did a best-effort patch by hooking it into the Lua memory allocations and raising an error on failed allocation, but that can still lead to leaks due to the way cjson was designed. I believe @pjsg is currently working on a streaming json library which would side-step all of cjson. |
I am (very slowly) working on it. However, my day job is taking all my bandwidth at the moment.... |
Do you guys know a way to go native to get a reliable implementation today?
I mean skipping Lua all together?
The SDK has cjson, unfortunately.
|
For decoding, I've made a lot of progress. There is a significant open issue around string encoding (utf8 versus 8-bit characters). I'm not sure if lua5.3 affects this.... |
I have just filed a PR #1755 that creates a new JSON encoder/decoder (that can be used as a dropin replacement for |
SJSON was merged a while ago -> closing |
Using the latest build, I haven't had a memory issues in a while. Thanks
for solving.
But I have problems with the LUA command line interpreter. Messages
sometimes arriving crumbled
and thus are not processed as function calls. 1:100 maybe.
Is there a bug report about that?
…On Wed, Mar 29, 2017 at 11:47 AM, Marcel Stör ***@***.***> wrote:
SJSON was merged a while ago -> closing
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1722 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAyuhuAWgcuO60bWV5Sp1SdTfQVaHvveks5rqqcpgaJpZM4LjYpP>
.
|
8<------------------------ BUG REPORT -----------------------------------------
Expected behavior
cjson.encode( text ) should always create the encoded string
Actual behavior
in low load situation is mostly does that, but when confronted with lots of strings to encode and then publish on an MQTT channel, it fails, and never recovers. A collectgarbage() does not help.
It is probably a memory leak. If you have ideas how to show that during test, please let me know.
Test code
Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.
This is how the function gets called, e.g.
This is the debug output. Every ">" represents a function call to this function. After the "%6" is does not recover and you have to reboot.
NodeMCU version
Which branch are you on? If you know the Git revision then add it here as well.
Using https://nodemcu-build.com/ with cjson and mqtt modules.
Hardware
Describe which ESP8266 device you use and document any special hardware setup
required to reproduce the problem.
We build our own board with the ESP8266. Baud rate is 9600 baud. No special hardware
is required. It is just a function call, happens very often via serial command line interface.
8<------------------------ END BUG REPORT -------------------------------------
The text was updated successfully, but these errors were encountered: