Fix #373: Correct mutex around log file write #376
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The mutex for the log file write during the WriteLogFileCmd
excution was held longer than it should have been.
This lock must NOT be held during EVS_SendEvent, as this
will cause deadlock.
This moves the mutex to protect only the area that actually
accesses the log data, and it moves all send event calls
to be AFTER the mutex is released.
Testing performed
Built all code using default config and start CFE
Externally issue the WriteLogDataFile command with a valid output file
Externally issued the WriteLogDataFile command with a invalid output file (where OS_creat fails)
Expected behavior changes
No longer deadlocks in the case of an error during the file operations
System(s) tested on:
Ubuntu 18.04.2 LTS 64-bit
Contributor Info
Joseph Hickey, Vantage Systems, Inc.