Queue drop
Behavior and Clean-Up Actions
#2557
LeStarch
announced in
Call for Comments
Replies: 1 comment 1 reply
-
This seems like a good idea. However, if we do this, I suggest adding a new queue full behavior such as
This is related to the issue that we should not have "passive" components with threads inside them. See nasa/fpp#261. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ports that have
drop
behavior on overflow can cause a resource leak when arguments require clean-up. Consider the case of passing anFw::Buffer
through a port. In most cases,Fw::Buffer
must be returned to the source (e.g. returning to the buffer manager buffer pool). If a port overflows, thatFw::Buffer
will be dropped and it would not be returned to the buffer manager. This is a resource leak.There is at-least one possible solutions, and a work-around.
Work-Around
Projects sending critical resources through a port call where these resources require clean-up actions should not use
drop
on the queues. To maintain similar behavior, users may implement async
orguarded
port, and implement their own queue cleaning-up on overflow.Solution: Add
<port>_dropHandler
To Auto-codeAutocode could be improved to add a
<port>_dropHandler
function for ports withdrop
behavior. This would be a synchronous function call with the same arguments as the port. The default implementation would be a no-op but users could override the behavior.Example
In this example, a buffer that is dropped can be cleaned-up.
Drawbacks
The primary drawback of this solution is more autocoded handlers. Additionally, users would still need to be aware and handle these cases.
Beta Was this translation helpful? Give feedback.
All reactions