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
[Gen 3] Fixes mesh pub/sub socket consuming all packet buffers #1839
Conversation
@technobly If we are doing 1.3.0-rc.2, sounds like a good idea to put it in there instead of 1.3.1 |
return SYSTEM_ERROR_NO_MEMORY; | ||
} | ||
|
||
udp_ = std::move(udp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clearing up the allocation leak.
wiring/src/spark_wiring_mesh.cpp
Outdated
|
||
// Use atomic exit_ as a simple synchronization primitive to ensure thread-safety | ||
// instead of a mutex here. | ||
if (exit_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a race condition here between reading and setting the value - an atomic exchange will avoid this.
if (exit_) { | |
if (exit_.exchange(true) { |
ad11f4e
to
9808280
Compare
…ishes. Cleans up code a bit as well
…eadsDataOutOfPubSubSocket test
…eadsDataOutOfPubSubSocket
9808280
to
24f4fa0
Compare
Problem
See #1828
Solution
This PR mainly simply starts mesh pub/sub thread that reads the data out of the socket even if only
publish()
is called.Apart from that it:
MeshPublish
classThread
class where the thread being started was not given processing time due toos_thread_yield
MESH_01_PublishWithoutSubscribeStillReadsDataOutOfPubSubSocket
test.Steps to Test
wiring/no_fixture
:MESH_01_PublishWithoutSubscribeStillReadsDataOutOfPubSubSocket
Example App
N/A
References
Completeness