-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Message Queue Limit to Prevent Memory Exhaustion in Embedde…
…d Devices The current network thread can produce unlimited messages to the queue which is consumed by the event thread. In embedded devices, we have limited memory, so a DDOS attack could exhaust the memory. Fixes Issue: #626 To fix this issue, (when OC_DYNAMIC_ALLOCATION is enabled) we use the macro OC_MAX_NUM_CONCURRENT_REQUESTS , which defines the maximum number of messages in the queue per device. The default value of OC_MAX_NUM_CONCURRENT_REQUESTS is 32. If the number of messages reaches the limit, all file descriptors in the network thread that produce oc_message_t are removed from select/poll. The file descriptor for monitoring the control flow is always set and is used to wake up from select() when the queue is ready to accept events again. When more file descriptors are ready to be read than the number of available queue slots, a subset is randomly selected to be pushed to the queue. --------- Co-authored-by: sp-milos <[email protected]> Co-authored-by: Daniel Adam <[email protected]>
- Loading branch information
1 parent
09b9743
commit 4a9fad5
Showing
30 changed files
with
1,337 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.