-
Notifications
You must be signed in to change notification settings - Fork 149
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
ensure sidecar response is null terminated #1569
Comments
will consider addressing this at the server end Line 40 in 421ca6e
|
perhaps enough to make it |
i've been poking at this and i believe that there is more than one thing going on. in the case that we read less than Lines 38 to 39 in 421ca6e
since we never allow the full size of CMD_CAPTURE_BYTES to be read it is safe to nb++ and then terminate. unfortunately that didn't fix the problem.
digging deeper stability improved when i disabled the background stat collection. looking at the code that makes sense. the looking at the nng docs on req sockets: https://nng.nanomsg.org/man/v1.3.2/nng_req.7.html
this all leads me to believe the some of all of the following would be worth considering:
|
actually, it looks like creating different nng "contexts" will allow concurrent use of the socket w/o getting things mixed up. |
awesome, makes sense and thanks for digging into it
this "feels" like it would be a good thing to do anyway, we don't really need that thread now that there is a separate async execution context available
i haven't eaten dinner and might be dense, but wouldn't |
not dense. you are correct - i think my brain was wanting it to be a simple off by one error. |
sigh. after much reworking of code, moving all the sync and async command invocation into C, and ensuring the interaction with the sidecar process is serialized - the stability problem in the selection menu persists. |
argh. it was an off by one error which i failed to spot: Lines 38 to 42 in 421ca6e
we read nb bytes from the pipe and get back 40 (for example) that means bytes 0-39 are valid output. we then null terminate the string with buf[nb] = '\0'; so byte 40 now is part of the valid output as well.... but then we return nb as the size of the captured output when it should be nb + 1 to account for the null character just added.
on the receiving side (back in matron) the nng message was ultimately loosing the null termination. code which at some point called |
derp sorry |
- capture buffer termination (issue monome#1569) - moves async command capture logic from lua to c - ensures sidecar requests from _norns.execute and _norns.system_cmd are not interleaved when called from different threads - adds progressive capture buffer allocation in server up to maximum of 10MB
- capture buffer termination (issue monome#1569) - moves async command capture logic from lua to c - ensures sidecar requests from _norns.execute and _norns.system_cmd are not interleaved when called from different threads - adds progressive capture buffer allocation in server up to maximum of 10MB
- capture buffer termination (issue #1569) - moves async command capture logic from lua to c - ensures sidecar requests from _norns.execute and _norns.system_cmd are not interleaved when called from different threads - adds progressive capture buffer allocation in server up to maximum of 10MB
the
norns-converged
branch exhibits stability issues around script selection. sometimes the menu hangs, other times it shows garbage at the end. looking at the code my current guess is the buffers returned from the sidecar are not null terminatednorns/norns/sidecar.cpp
Line 153 in 421ca6e
The text was updated successfully, but these errors were encountered: