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
C.JSON not work on go 1.18 #1820
Comments
Can you send issue to https://github.com/goccy/go-json |
same here, but I get |
Sorry 😅😅 |
@luyouxin84 @limjinyung What version of fiber are you using? |
github.com/gofiber/fiber/v2 v2.23.0 |
Update version. It will be solved probably. Also i recommend everybody to use latest version of Fiber. They include most bug fixes and features. |
can't reproduce
|
I'm closing the issue because of this. If you problem not solved, feel free to re-open the issue. |
I am seeing this crash on v2.30.0 the JSON encoder is crashing. |
what's the payload that causes that? |
I removed lots of code while it was still crashing and ended up with this: using:
Please see NOTES in code.
|
confirmed github.com/gofiber/fiber/v2/internal/go-json/encoder.copyOpcode(0x0)
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/internal/go-json/encoder/opcode.go:322 +0x4a
github.com/gofiber/fiber/v2/internal/go-json/encoder.(*Compiler).linkRecursiveCode(0xc0000c0098, 0xc0000c6690)
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/internal/go-json/encoder/compiler.go:892 +0x135
github.com/gofiber/fiber/v2/internal/go-json/encoder.(*Compiler).codeToOpcode(0xc0000c0098, 0xc0000c6690, 0x91b1a0, {0x9b1668, 0xc0000c6450})
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/internal/go-json/encoder/compiler.go:883 +0xb1
github.com/gofiber/fiber/v2/internal/go-json/encoder.(*Compiler).codeToOpcodeSet(0xc0000c0098, 0x91b1a0, {0x9b1668, 0xc0000c6450})
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/internal/go-json/encoder/compiler.go:108 +0x196
github.com/gofiber/fiber/v2/internal/go-json/encoder.(*Compiler).compile(0xc0000c0098, 0x91b1a0)
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/internal/go-json/encoder/compiler.go:104 +0x12f
github.com/gofiber/fiber/v2/internal/go-json/encoder.CompileToGetCodeSet(0xc0000e6750, 0x91b1a0)
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/internal/go-json/encoder/compiler_norace.go:18 +0x25b
github.com/gofiber/fiber/v2/internal/go-json.encode(0xc0000e6750, {0x91b1a0, 0xc0000e4150})
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/internal/go-json/encode.go:224 +0xed
github.com/gofiber/fiber/v2/internal/go-json.marshal({0x91b1a0, 0xc0000e4150}, {0x0, 0x0, 0x0})
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/internal/go-json/encode.go:148 +0x189
github.com/gofiber/fiber/v2/internal/go-json.MarshalWithOption({0x91b1a0, 0xc0000e4150}, {0x0, 0x0, 0x0})
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/internal/go-json/json.go:186 +0xa5
github.com/gofiber/fiber/v2/internal/go-json.Marshal({0x91b1a0, 0xc0000e4150})
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/internal/go-json/json.go:171 +0x7c
github.com/gofiber/fiber/v2.(*Ctx).JSON(0xc0000de000, {0x91b1a0, 0xc0000e4150})
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/ctx.go:695 +0x87
main.main.func1(0xc0000de000)
/home/kyz/go/src/fibercrashexample/a.go:46 +0x18c
github.com/gofiber/fiber/v2.(*App).next(0xc0000001e0, 0xc0000de000)
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/router.go:132 +0x39a
github.com/gofiber/fiber/v2.(*App).handler(0xc0000001e0, 0xc0000d0000)
/home/kyz/go/pkg/mod/github.com/gofiber/fiber/v2@v2.30.0/router.go:160 +0x91
github.com/valyala/fasthttp.(*Server).serveConn(0xc00013e480, {0x9b2318, 0xc0000c0008})
/home/kyz/go/pkg/mod/github.com/valyala/fasthttp@v1.34.0/server.go:2341 +0x1612
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc000128c80, 0xc0000ce000)
/home/kyz/go/pkg/mod/github.com/valyala/fasthttp@v1.34.0/workerpool.go:224 +0xe7
github.com/valyala/fasthttp.(*workerPool).getCh.func1()
/home/kyz/go/pkg/mod/github.com/valyala/fasthttp@v1.34.0/workerpool.go:196 +0x47
created by github.com/valyala/fasthttp.(*workerPool).getCh
/home/kyz/go/pkg/mod/github.com/valyala/fasthttp@v1.34.0/workerpool.go:195 +0x2d1 |
anonymous struct is the culprit, without anonymous struct it doesn't crash |
As a workaround, you can set |
Same problem i already faced in my project and change gofiber default json to ffjson. |
It works with json.Marshal |
@luisgarciaalanis can you test it with the version 2.31.0 or the current master commit require github.com/gofiber/fiber/v2 v2.31.1-0.20220405064022-a8f9d4acfb2c |
I ran into this issue using 2.30.0. Upgrading to 2.31.0 resolved the issue. |
in go 1.17.8 c.json work fine,but after i upgrade go version , c.json not work report "runtime error empty pointer"
The text was updated successfully, but these errors were encountered: