Closed stefankiesz closed 11 months ago
Patch coverage: 75.00%
and project coverage change: +0.04%
:tada:
Comparison is base (
98cc135
) 75.16% compared to head (2a0a989
) 75.21%.:exclamation: Current head 2a0a989 differs from pull request most recent head 6c6993c. Consider uploading reports for the commit 6c6993c to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Overview
Removes the possibility of segfault errors occurring from stack overflows caused by recursive
stepStateMachine()
calls made internally by the stream pointer functions passed asexecuteStateFn
to the stream state machine. Implements the following changes:iterateStreamStateMachine()
added to the StreamState filekeepIteratingStateMachine
added to the KinesisVideoStream struct to track when to keep callingstepStateMachine()
stepStateMachine()
calls removed fromexecuteStateFn
functionsiterateStreamStateMachine()
makesstepStateMachine()
calls as needed based on how was done in theexecuteStateFn
functionsstepStateMachine()
calls upon the stream state machine that are outside ofiterateStreamStateMachine()
replaced byiterateStreamStateMachine()
callsThe functionality of the internal stepping of the state machine remains similar to the existing functionality, but the
executeStateFn
functions now set thekeepIteratingStateMachine
member to TRUE rather than callingstepStateMachine()
.Stream State Behavior for Reference
stepStateMachine()
: NEWstepStateMachine()
: READY, STOPPEDstepStateMachine()
: DESCRIBE, CREATE, TAG_STREAM, GET_ENDPOINT, GET_TOKEN, PUT_STREAM, STREAMINGTesting
To test these changes' success in preventing the state transition segfaults, the state machine was forced into an endless loop by commenting out the following line in
fromNewStreamState()
:The state machine would then endlessly transition from and to STREAM_STATE_NEW.
Without the iterator, this almost immediately caused a segfault, not even reaching 40,000 recursive calls:
Using the iterator, the sate machine continues to transition, reaching over 4 million iterations in ~1min:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.