-
Notifications
You must be signed in to change notification settings - Fork 52
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
panic #49
Comments
A legible stack trace from the panic would make troubleshooting much easier. |
@ISNing I noticed the same problem and endet up here, too, after investigating it. @andybalholm I cleaned up the stack trace a little bit:
I don't know anything about Go, but it looks like the bytes sent to the compressor themselves produce the error. func compressWithBrotli(bodyBytes []byte) ([]byte, error) {
var buf bytes.Buffer
brWriter := brotli.NewWriterLevel(&buf, brotli.DefaultCompression)
if _, err := brWriter.Write(bodyBytes); err != nil {
log.Printf("unable to recompress rewrited body: %v", err)
return nil, err
}
if err := brWriter.Close(); err != nil {
log.Printf("unable to close zlib writer: %v", err)
return nil, err
}
return buf.Bytes(), nil
} There seems to be no additional "interface" than the Asking as a Golang noob:
Also, I find it interesting, that the error occurs in line 118: Lines 117 to 119 in 17e5901
If I understand the error correctly. somehow there seems to be a negative or signed number, which shouldn't be here. |
The stack traces reference a call to |
I tried, but was unsuccessful. Then I found this: (from https://plugins.traefik.io/create)
That would explain the oddities around this bug: It's not the code, it's the interpreter |
I'm going to venture a guess that the actual bug is in Yaegi. |
It seems I reproduced the panic by following example(If i didn't make any mistake on writing the code): package main
func backwardReferencePenaltyUsingLastDistance(distance_short_code uint) uint {
return uint(39) + ((0x1CA10 >> (distance_short_code & 0xE)) & 0xE)
}
func main() {
println(backwardReferencePenaltyUsingLastDistance(uint(1)))
} $ go run test.go Produces the following output:
$ yaegi test.go Produces the following output:
For latest version of yaegi, there's nothing different:
|
Created issue for yaegi here: traefik/yaegi#1653 |
The issue of yaegi has been fixed, closing issue. |
I'm currently working on a plugin for traefik(a reverse proxy app written in go) used for replacing response body, but for specified upstream, it produces panic. But for basic whoami testing and unit tests, it works well...
Does I miss anything? (Related code: the-ccsn/traefik-plugin-rewritebody@378f703)
version of brotli: v1.1.0
The text was updated successfully, but these errors were encountered: