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
The following program sample.go triggers an unexpected result
//this is except from actual code from the pluginpackage traefikplugin
import (
"net/rpc"...
)
// call is called once per request in the middlewarefunccall() err {
...reqStart:=time.Now()
reqCtx, cancel:=context.WithTimeout(context.Background(), 30*time.Milliseconds)
defercancel()
done:=client.Go(method, args, reply, make(chan*rpc.Call, 1)).Done// wait for network or timeoutselect {
caseresponse:=<-done:
returnresponse.Errorcase<-reqCtx.Done():
returnfmt.Errorf(
"rpc: call timed out: %w, net_call/duration=%s",
reqCtx.Err(),
time.Since(reqStart),
)
}
}
which effectively means that context has yielded on reqCtx.Done() chan before the timeout was reached and the reqCtx.Err() is nil.
This occurs under relatively high load instance, with ~70hit/s on particular plugin utilizing the code and global load on same Traefik instance is ~400 hit/s.
The issue is occurring for ~0.08% (out of 70hits/s on the plugin) of requests handled.
so probably it is some kind of low level race condition in yaegi.
Sorry I haven't provided the fully functional code for reproducing the bug.
If you ultimately need it, I can try to create a minimal reproducible example a bit later.
The text was updated successfully, but these errors were encountered:
The following program
sample.go
triggers an unexpected resultExpected result
rpc: call timed out: context deadline exceeded, net_call/duration=30.209943ms
Got
rpc: call timed out: %!w(<nil>), net_call/duration=1.429943ms
Yaegi Version
v0.16.1
Additional Notes
It should handle timeouts correctly, and not yield prematurely
In Traefik context, on the logs I can observe messages like this from my custom written plugin:
which effectively means that context has yielded on reqCtx.Done() chan before the timeout was reached and the reqCtx.Err() is nil.
This occurs under relatively high load instance, with ~70hit/s on particular plugin utilizing the code and global load on same Traefik instance is ~400 hit/s.
The issue is occurring for ~0.08% (out of 70hits/s on the plugin) of requests handled.
so probably it is some kind of low level race condition in yaegi.
Sorry I haven't provided the fully functional code for reproducing the bug.
If you ultimately need it, I can try to create a minimal reproducible example a bit later.
The text was updated successfully, but these errors were encountered: