Skip to content
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

Merged
merged 8 commits into from Jul 29, 2019

Conversation

@avtolstoy
Copy link
Member

commented Jun 26, 2019

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:

  1. Refactors/cleans up MeshPublish class
  2. Provides a workaround for wiring Thread class where the thread being started was not given processing time due to os_thread_yield
  3. Enables mutlicast loop LwIP options which enables on-device testing of mesh pub/sub and adds the MESH_01_PublishWithoutSubscribeStillReadsDataOutOfPubSubSocket test.

Steps to Test

  • wiring/no_fixture: MESH_01_PublishWithoutSubscribeStillReadsDataOutOfPubSubSocket

Example App

N/A

References


Completeness

  • [bugfix] [Gen 3] Fixes mesh pub/sub socket consuming all packet buffers

@avtolstoy avtolstoy added this to the 1.3.1-rc.1 milestone Jun 26, 2019

@avtolstoy avtolstoy requested review from sergeuz, XuGuohui and technobly Jun 26, 2019

@avtolstoy

This comment has been minimized.

Copy link
Member Author

commented Jul 3, 2019

@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);

This comment has been minimized.

Copy link
@m-mcgowan

m-mcgowan Jul 23, 2019

Contributor

Thanks for clearing up the allocation leak.


// Use atomic exit_ as a simple synchronization primitive to ensure thread-safety
// instead of a mutex here.
if (exit_) {

This comment has been minimized.

Copy link
@m-mcgowan

m-mcgowan Jul 23, 2019

Contributor

there's a race condition here between reading and setting the value - an atomic exchange will avoid this.

Suggested change
if (exit_) {
if (exit_.exchange(true) {

@avtolstoy avtolstoy force-pushed the fix/gen3-mesh-pubsub-packet-buffers branch from ad11f4e to 9808280 Jul 24, 2019

@avtolstoy avtolstoy requested a review from m-mcgowan Jul 24, 2019

@avtolstoy avtolstoy force-pushed the fix/gen3-mesh-pubsub-packet-buffers branch from 9808280 to 24f4fa0 Jul 29, 2019

@avtolstoy avtolstoy merged commit 3497493 into develop Jul 29, 2019

3 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@avtolstoy avtolstoy deleted the fix/gen3-mesh-pubsub-packet-buffers branch Jul 29, 2019

@technobly technobly removed request for sergeuz, technobly and XuGuohui Aug 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.