You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
async_receive2 completes with zero complete messages #373
While playing with valgrind massif I produced a condition where async_receive2 completes with zero messages. I noticed this because flat_tree::get_total_msgs() was returning 0. From looking at the code I could not spot the problem so I will have to investigate more.
Found the problem: The push was arriving before I set the receive response and therefore it was being handled in the default adapter. I think this should be considered a misuse of the API: the receive response must be set before any pushes might possibly arrive i.e. before calling async_run.
We have some heuristics where under certain edge cases a regular message is interpreted as a push. I'm worried exiting with an error could do harm if these cases are hit and the user is not actually expecting pushes. Maybe we could issue a warning in the log?
I think there is room to improve the heuristics, for example
Unsolicited errors (- and !) should not be sent over the receive channel but logged only.
The receive channel should only get pushes (>). This will make a custom message types for pushes more reliable and simpler to write i.e. no need to handle errors.
Any other resp3 type for which there is no corresponding request should cause an error and async_run to exit.
This makes it harder to write custom response types since they have to accomodate for all possibilities. It is pretty hard to traverse a generic_response dealing with all kinds of responses.
Yeah, pretty evil. I don't think it's a common case, although we should probably still support it. I'll think of it. I agree the current status quo is not good.
Activity
mzimbres commentedon Dec 14, 2025
Found the problem: The push was arriving before I set the receive response and therefore it was being handled in the default adapter. I think this should be considered a misuse of the API: the receive response must be set before any pushes might possibly arrive i.e. before calling
async_run.anarthal commentedon Dec 14, 2025
We could make the receive adapter part of config to prevent this, maybe?
mzimbres commentedon Dec 14, 2025
Yes, I think that is the correct thing to do. Also, I think
async_runshould exit with error if no receive adapter is set and a push is received.anarthal commentedon Dec 14, 2025
We have some heuristics where under certain edge cases a regular message is interpreted as a push. I'm worried exiting with an error could do harm if these cases are hit and the user is not actually expecting pushes. Maybe we could issue a warning in the log?
mzimbres commentedon Dec 14, 2025
I think there is room to improve the heuristics, for example
-and!) should not be sent over the receive channel but logged only.>). This will make a custom message types for pushes more reliable and simpler to write i.e. no need to handle errors.async_runto exit.anarthal commentedon Dec 14, 2025
Wasn't MONITOR using a response type that wasn't a push (
>)?mzimbres commentedon Dec 14, 2025
Indeed, just check and it looks like it sends simple strings
This makes it harder to write custom response types since they have to accomodate for all possibilities. It is pretty hard to traverse a generic_response dealing with all kinds of responses.
anarthal commentedon Dec 14, 2025
Yeah, pretty evil. I don't think it's a common case, although we should probably still support it. I'll think of it. I agree the current status quo is not good.