For 4.1.6: rabbit_logger_exchange_h: Do not re-enter itself (backport #14796) (backport #14804) #14808
+77
−15
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.
Why
Publishing a log message to an exchange might trigger other messages to be logged. This caused two issues:
How
The first issue is fixed with a variable stored in the process dictionary by the
log/2function. This way, the function can check if it is called from itself because the first incantation stored a variable there.The second issue is fixed by publishing the message asynchronously from a separate process. This is ok because we don't care if the publish was successful or not. We re-use the process that was started initially to declare the exchange.
Fixes #14069.
This is an automatic backport of pull request #14796 done by Mergify.
This is an automatic backport of pull request #14804 done by Mergify.