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

[Gen3] Fixes a HeapError panic due to malloc() call from an ISR (caused by rand() usage) #1786

Merged
merged 2 commits into from May 19, 2019

Conversation

@avtolstoy
Copy link
Member

commented May 18, 2019

Problem

rand() when called from an ISR will attempt to allocate _reent struct from heap for thread safety, which shouldn't happen in the interrupt context.

Solution

The main fix is in OpenThread repo: particle-iot/openthread#1

This PR simply initializes random seed to be used by Nordic 802.15.4 CSMA/CA.

NOTE: this is a stop-gap solution and we'll report this issue to OpenThread/Nordic on Monday, so that they can come up with something that doesn't require the seed to be provided externally

Steps to Test

Just let the devices run for a while doing all sorts of mesh communications. They should no longer panic.

Example App

N/A

References


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

  • [bugfix] [Gen3] Fixes a HeapError panic due to malloc() call from an ISR (caused by rand() usage) #1786

@avtolstoy avtolstoy added the bug label May 18, 2019

@avtolstoy avtolstoy added this to the 1.2.0-rc.1 milestone May 18, 2019

@avtolstoy avtolstoy requested review from sergeuz and technobly May 18, 2019

@avtolstoy avtolstoy force-pushed the fix/gen3-rand-malloc-assertion branch from 075194f to 12b345f May 18, 2019

@avtolstoy avtolstoy force-pushed the fix/gen3-rand-malloc-assertion branch from 12b345f to d3861c0 May 19, 2019

@avtolstoy avtolstoy merged commit 3abe159 into develop May 19, 2019

2 checks passed

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-rand-malloc-assertion branch May 19, 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.