Should global timeout override timeout in provided context? #1144
Comments
Some more context after digging into this further. I've also tried altering the deadline/timeout by directly updating the call options with
It looks like after overriding the timeout as described in the previous comment, the deadline in the call options is updated using the global timeout value if the deadline calculated using that global timeout value comes before the explicitly provided deadline. It seems like I could decrease the deadline using |
I shared some additional context offline, but for the benefit of anyone following this thread, this problem only seems to occur for a |
@igorbernstein2, per our discussion, if you could weigh in on the code in question, we'd appreciate it. |
@nwbirnie so we continue discussion about this behavior as we debug the code. |
Ok so there are two parts to this issue, if I'm understanding things:
(1) can be resolved by changing the condition to respect whatever timeout is set on the context: if (totalTimeout != null && context != null && context.getTimeout() == null) {
context = context.withTimeout(totalTimeout);
} However, allowing this then begs the question of (2). We'd need to add additional logic to check if the provided context timeout would expire sooner or later than the (2) is essentially "should we allow users to increase a timeout via the I think that it is reasonable to take a more restrictive approach from the Context for discussion: we are designing the addition of overloads to set per-logical call @igorbernstein2 can you weigh in on the questions above? |
This is a bit messy and I apologize for my contributions to the messiness. So if I understand correctly there are a few timeouts at play here:
and they overlap and play different roles depending on the context As we discussed I think this should be cleaned up where the user only controls a single timeout overall time and the rpc deadlines are derived from it. I also think users should be able to override the default deadline per call. So I agree with solution 1 where the user's overrride is respected. Though I thinkfor the second problem, totalTimeout should be adjusted (including expanded) to the user's desires. Ignoring backwards compatibility , I think the correct state would be:
With backwards compatibility I think the transition can be:
|
Ok, so the future state of exposing a new per-call Settings API is in the near/medium future. The ideal end states you've described here are valuable. There is generator work and a design to write up for this. Immediately, can I make the change for (1) - respecting a user-provided timeout on an |
Ok, so #1155 fixed (1) - an I discussed with @igorbernstein2 offline if the same change should be made to As for (2) - with ServerStreamingAttemptCallable, a caller-provided context should be able to lengthen the timeout if provided via I downgraded the ticket, because we were able to work around it for the specific use case, probably should've done that before. I kept this open with |
Moving this to P3 until ndietz@ is back in Q1. |
#1324 will fix this specific issue by respecting a timeout set via |
When calling
ServerStreamingCallable.call(request, context)
with a context set like sothe global timeout settings override the provided context. As a result, I cannot override global settings. Is this intended behavior, or is this a bug? If intended behavior, how can I override the global settings?
The text was updated successfully, but these errors were encountered: