-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FindProviders needs a timeout #400
Comments
Would passing the context down into the function work? Or does the callstack hit a wall where a message is passed over a channel? |
Well, we do have a context passed down. but the passed in context is not guaranteed to ever be cancelled |
The language won't prevent you from extending FindProviders with its own timeout, but early termination is not really its call to make. That's the caller's responsibility. There are three types of contexts
Are we seeing instances of 2 and 3 along the callpath to this subsystem where they shouldn't be? |
yeah, we are seeing 2 and 3 in the FindProviders calls |
I didn't see 2 or 3 in the FindProviders/GetProviders calls. Maybe I'm misunderstanding what you're seeing. In any case, I took a look at code and fixed a couple things that stood out. 1 2 |
Agreed fully. This is particularly important when wanting to work in high-latency-low-bandwidth networks (mobile everywhere outside the US).
Shouldn't this really be: select {
case pm.getprovs <- gp:
select {
case resp := <- gp.resp:
return resp
case <-ctx.Done():
return nil
}
case <-ctx.Done():
return nil
} Or to make it more readable: // send out async get providers request
select {
case <-ctx.Done():
return nil
case pm.getprovs <- gp:
}
// receive a request response
select {
case <-ctx.Done():
return nil
case resp := <- gp.resp:
return resp
} |
|
no this function is the only reader. whatever is at the other side of |
my mistake. will fix using this one: // send out async get providers request
select {
case <-ctx.Done():
return nil
case pm.getprovs <- gp:
}
// receive a request response
select {
case <-ctx.Done():
return nil
case resp := <- gp.resp:
return resp
} |
Is this fixed on master? pls reopen if not. |
feat: allow disabling value and provider storage/messages
In some 'real world' testing ive been find a large number of goroutines stuck waiting for 'FindProviders' requests to come back, looking into this, There is no timeout set on those requests (sent off into goroutines) so they wait forever for a request from the service. This causes an ugly memory leak of goroutines. What do you guys think an appropriate way to handle this is?
The text was updated successfully, but these errors were encountered: