go-graphviz icon indicating copy to clipboard operation
go-graphviz copied to clipboard

panic: segmentation violation

Open ruokeqx opened this issue 1 year ago • 1 comments

I encountered a crash when using go-callvis, and it seems program crash at go-graphviz/internal/ccall._Cfunc_agmemread Agraph_t *agmemread(const char *cp), i am not sure if it is fixed by graphviz, maybe you should update cgraph?

> go-callvis -group pkg -nostd .
2023/09/06 21:27:57 http serving at http://localhost:7878



2023/09/06 21:49:32 converting dot to svg..
2023/09/06 21:49:32 serving file: /var/folders/6_/65ws8fc97bz20h4r7knc5ngh0000gn/T/go-callvis_export.svg
2023/09/06 22:52:16 converting dot to svg..
2023/09/06 22:52:46 serving file: /var/folders/6_/65ws8fc97bz20h4r7knc5ngh0000gn/T/go-callvis_export.svg
2023/09/06 23:42:05 converting dot to svg..
2023/09/06 23:42:06 serving file: /var/folders/6_/65ws8fc97bz20h4r7knc5ngh0000gn/T/go-callvis_export.svg
2023/09/06 23:42:07 converting dot to svg..
2023/09/06 23:42:08 serving file: /var/folders/6_/65ws8fc97bz20h4r7knc5ngh0000gn/T/go-callvis_export.svg
2023/09/06 23:42:13 converting dot to svg..
2023/09/06 23:42:14 serving file: /var/folders/6_/65ws8fc97bz20h4r7knc5ngh0000gn/T/go-callvis_export.svg
2023/09/06 23:44:03 converting dot to svg..
2023/09/06 23:44:05 serving file: /var/folders/6_/65ws8fc97bz20h4r7knc5ngh0000gn/T/go-callvis_export.svg
2023/09/06 23:46:39 converting dot to svg..
2023/09/06 23:46:40 serving file: /var/folders/6_/65ws8fc97bz20h4r7knc5ngh0000gn/T/go-callvis_export.svg
2023/09/06 23:47:26 converting dot to svg..
2023/09/06 23:47:26 converting dot to svg..
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x68 pc=0x1004f68f7]

runtime stack:
runtime.throw({0x10072676a?, 0x600000c1a510?})
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/runtime/panic.go:992 +0x71
runtime.sigpanic()
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/runtime/signal_unix.go:802 +0x396

goroutine 8433 [syscall]:
runtime.cgocall(0x1004e0bd0, 0xc015da7788)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/runtime/cgocall.go:157 +0x5c fp=0xc015da7760 sp=0xc015da7728 pc=0x10000515c
github.com/goccy/go-graphviz/internal/ccall._Cfunc_agmemread(0x134c35000)
        _cgo_gotypes.go:1449 +0x49 fp=0xc015da7788 sp=0xc015da7760 pc=0x100471e09
github.com/goccy/go-graphviz/internal/ccall.Agmemread({0xc018100000?, 0xc01743e000?})
        /Users/ruokeqx/go/pkg/mod/github.com/goccy/[email protected]/internal/ccall/cgraph.go:883 +0x2e fp=0xc015da77b8 sp=0xc015da7788 pc=0x1004781ce
github.com/goccy/go-graphviz/cgraph.ParseBytes({0xc01743e000, 0x3440b, 0x2c?})
        /Users/ruokeqx/go/pkg/mod/github.com/goccy/[email protected]/cgraph/cgraph.go:105 +0x4d fp=0xc015da7808 sp=0xc015da77b8 pc=0x10047db0d
github.com/goccy/go-graphviz.ParseBytes(...)
        /Users/ruokeqx/go/pkg/mod/github.com/goccy/[email protected]/graphviz.go:50
main.runDotToImage({0x0, 0x0}, {0x10070d734, 0x3}, {0xc01743e000, 0x3440b, 0x3440b})
        /Users/ruokeqx/go/pkg/mod/github.com/ofabry/[email protected]/dot_cgo.go:17 +0xa7 fp=0xc015da7910 sp=0xc015da7808 pc=0x1004d8627
main.dotToImage({0x0?, 0x3?}, {0x10070d734?, 0x6?}, {0xc01743e000?, 0x100b7c000?, 0xc01d58e734?})
        /Users/ruokeqx/go/pkg/mod/github.com/ofabry/[email protected]/dot.go:153 +0x45 fp=0xc015da7958 sp=0xc015da7910 pc=0x1004d7f45
main.handler({0x1007e8f70?, 0xc02d258000}, 0xc021abba00)
        /Users/ruokeqx/go/pkg/mod/github.com/ofabry/[email protected]/handler.go:53 +0x5f7 fp=0xc015da7a20 sp=0xc015da7958 pc=0x1004d9017
net/http.HandlerFunc.ServeHTTP(0x12e42f890?, {0x1007e8f70?, 0xc02d258000?}, 0x10000ec45?)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:2084 +0x2f fp=0xc015da7a48 sp=0xc015da7a20 pc=0x100428fef
net/http.(*ServeMux).ServeHTTP(0x0?, {0x1007e8f70, 0xc02d258000}, 0xc021abba00)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:2462 +0x149 fp=0xc015da7a98 sp=0xc015da7a48 pc=0x10042a989
net/http.serverHandler.ServeHTTP({0xc027d39770?}, {0x1007e8f70, 0xc02d258000}, 0xc021abba00)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:2916 +0x43b fp=0xc015da7b58 sp=0xc015da7a98 pc=0x10042c5db
net/http.(*conn).serve(0xc0159a5220, {0x1007e9348, 0xc05b92eba0})
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:1966 +0x5d7 fp=0xc015da7fb8 sp=0xc015da7b58 pc=0x100427a97
net/http.(*Server).Serve.func3()
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:3071 +0x2e fp=0xc015da7fe0 sp=0xc015da7fb8 pc=0x10042cf2e
runtime.goexit()
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc015da7fe8 sp=0xc015da7fe0 pc=0x100064881
created by net/http.(*Server).Serve
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:3071 +0x4db

goroutine 1 [IO wait, 70 minutes]:
internal/poll.runtime_pollWait(0x128c20308, 0x72)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/runtime/netpoll.go:302 +0x89
internal/poll.(*pollDesc).wait(0xc022b82900?, 0x48?, 0x0)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/internal/poll/fd_poll_runtime.go:83 +0x32
internal/poll.(*pollDesc).waitRead(...)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/internal/poll/fd_poll_runtime.go:88
internal/poll.(*FD).Accept(0xc022b82900)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/internal/poll/fd_unix.go:614 +0x22c
net.(*netFD).accept(0xc022b82900)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/fd_unix.go:172 +0x35
net.(*TCPListener).accept(0xc015259ae8)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/tcpsock_posix.go:139 +0x28
net.(*TCPListener).Accept(0xc015259ae8)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/tcpsock.go:288 +0x3d
net/http.(*Server).Serve(0xc02ba58fc0, {0x1007e8d90, 0xc015259ae8})
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:3039 +0x385
net/http.(*Server).ListenAndServe(0xc02ba58fc0)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:2968 +0x7d
net/http.ListenAndServe(...)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:3222
main.main()
        /Users/ruokeqx/go/pkg/mod/github.com/ofabry/[email protected]/main.go:159 +0x425

goroutine 8869 [runnable]:
net/http.(*conn).hijacked(0x10000ec45?)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:307 +0xa7
net/http.(*response).WriteHeader(0xc02d2580e0, 0x1f4)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:1135 +0x45
net/http.Error({0x1007e8f70, 0xc02d2580e0}, {0xc060c6fb90, 0x22}, 0xc018f80000?)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:2096 +0x198
main.handler({0x1007e8f70?, 0xc02d2580e0}, 0xc014e85400)
        /Users/ruokeqx/go/pkg/mod/github.com/ofabry/[email protected]/handler.go:55 +0x745
net/http.HandlerFunc.ServeHTTP(0x12e42f980?, {0x1007e8f70?, 0xc02d2580e0?}, 0x10000ec45?)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0x1007e8f70, 0xc02d2580e0}, 0xc014e85400)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0xc02ef201b0?}, {0x1007e8f70, 0xc02d2580e0}, 0xc014e85400)
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc0228f7900, {0x1007e9348, 0xc05b92eba0})
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
        /usr/local/Cellar/[email protected]/1.18.10/libexec/src/net/http/server.go:3071 +0x4db

ruokeqx avatar Sep 07 '23 06:09 ruokeqx

similar to https://github.com/goccy/go-graphviz/issues/20 , but different cgo function. maybe go-callvis is a way to reproduce this

ruokeqx avatar Sep 07 '23 07:09 ruokeqx