New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(buffer_worker): avoid sending late reply messages to callers #10455
fix(buffer_worker): avoid sending late reply messages to callers #10455
Conversation
0efc511
to
818d8fa
Compare
@@ -295,19 +295,19 @@ pick_call(Id, Key, Query, Timeout) -> | |||
?PICK(Id, Key, Pid, begin | |||
Caller = self(), | |||
MRef = erlang:monitor(process, Pid, [{alias, reply_demonitor}]), | |||
From = {Caller, MRef}, | |||
From = {Caller, [alias | MRef]}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is pretty complicated, it would be great to explain what's going on in a comment.
Q: why does From contain an improper list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll drop the usage of gen_statem:reply
and go back to my first solution of just sending to MRef
the reply, after Stone's comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
鉁旓笍
Fixes https://emqx.atlassian.net/browse/EMQX-9635 During a sync call from process `A` to a buffer worker `B`, its call to the underlying resource `C` can be very slow. In those cases, `A` will receive a timeout response and expect no more messages from `B` nor `C`. However, prior to this fix, if `B` is stuck in a long sync call to `C` and then gets its response after `A` timed out, `B` would still send the late response to `A`, polluting its mailbox.
818d8fa
to
cb995e2
Compare
Pull Request Test Coverage Report for Build 4748080857
馃挍 - Coveralls |
Fixes https://emqx.atlassian.net/browse/EMQX-9635
During a sync call from process
A
to a buffer workerB
, its call to the underlying resourceC
can be very slow. In those cases,A
will receive a timeout response and expect no more messages fromB
norC
. However, prior to this fix, ifB
is stuck in a long sync call toC
and then gets its response afterA
timed out,B
would still send the late response toA
, polluting its mailbox.Summary
馃 Generated by Copilot at 8b5521b
Added a new function
reply_call/2
toemqx_resource_buffer_worker
module to improve query request handling and tracing. Updated the version number of theemqx_resource
application. Added test cases for timeout and late reply scenarios using theemqx_connector_demo
module.PR Checklist
Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:
changes/{ce,ee}/(feat|perf|fix)-<PR-id>.en.md
filesChecklist for CI (.github/workflows) changes
changes/
dir for user-facing artifacts update