Replies: 3 comments 2 replies
-
The use of If we do not have any chance to yield in the async function See |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response. I will have a look at the links you provided. To clarify and confirm, the actual code doesn't use sleep but another blocking call. I take your comments apply regardless and the issue is the blocking call (any blocking call within timeout() ). |
Beta Was this translation helpful? Give feedback.
-
So the timer doesn't start straight away when calling write_to_socket() but rather when we first return Poll::Pending anywhere in I was thinking that |
Beta Was this translation helpful? Give feedback.
-
I've been chasing down a bug at work, and eventually got down to this repro:
The first thing to notice is that the response takes longer than 100 ms. I suppose this is expected as the sleep call is blocking.
After the sleep, I'd expect the timeout to kick in at any of the following async calls, and an error being returned.
What I'm seeing is that sometimes I get an Ok response even when the elapsed time was much higher than 100ms (i.e., the timeout never kicks in):
Is this because at times the async calls (connect, write_all and read_to_end) are not yielding? Why?
If I insert an explicit call to yield_now I always get the
deadline has elapsed
error.Beta Was this translation helpful? Give feedback.
All reactions