Skip to content
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

gomobile: fatal error: stack split at bad time #84

Open
hussainmohd-a opened this issue Aug 19, 2024 · 1 comment
Open

gomobile: fatal error: stack split at bad time #84

hussainmohd-a opened this issue Aug 19, 2024 · 1 comment

Comments

@hussainmohd-a
Copy link

I  ipmap.go:202: D ipmap: Get: 2001:4860:4860::8844 => []
I  protect.go:67: D control: netbinder: Exit: udp6([2001:4860:4860::8844]:53); err? <nil>
D  bind: Exit, 214, rinr? true
W  no network to bind, who: Exit, [2001:4860:4860::8844]:53
I  rdial.go:153: D rdial: commondial: confirmed ip 2001:4860:4860::8844 for [2001:4860:4860::8844]:53 failed with err dial udp [2001:4860:4860::8844]:53: connect: network is unreachable
I  rdial.go:142: D rdial: duration: 1.165615ms; failed [2001:4860:4860::8844]:53; confirmed? 2001:4860:4860::8844, sz: 1
E  udp.go:360: W udp: connect: #0: 424b0859de37738a failed; addr([2001:4860:4860::8844]:53); for uid rethink (1s) w err(dial udp [2001:4860:4860::8844]:53: connect: network is unreachable)
I  exit.go:53: I proxy: exit: dial(udp) to [2001:4860:4860::8844]:53; err? dial udp [2001:4860:4860::8844]:53: connect: network is unreachable
E  udp.go:256: W udp: proxy: unexpected [fd66:f83a:c650::1]:57925 -> [2001:4860:4860::8844]:53; err: dial udp [2001:4860:4860::8844]:53: connect: network is unreachable
D  onSocketClosed: SocketSummary{Proto:udp,ID:424b0859de37738a,PID:Exit,UID:rethink,Target:2001:4860:4860::8844,Rx:0,Tx:0,Duration:0,Rtt:0,Msg:dial udp [2001:4860:4860::8844]:53: connect: network is unreachable,}
D  com.celzero.bravedns/com.celzero.bravedns.ui.HomeScreenActivity,This DecorView@a0d09ec[HomeScreenActivity] change focus to true
I  local brave dns object is set with stamp: 1:4AUCAAQAAAEQcCAA
D  init remote rdns mode
I  remote-rdns enabled
I  adding blockfree url: https://sky.rethinkdns.com/dns-query
I  ipmap.go:245: D ipmap: renew: sky.rethinkdns.com / seed: [172.67.214.246 104.21.83.62 2606:4700:3030::ac43:d6f6 2606:4700:3030::6815:533e] / typ: Auto
I  ipmap.go:271: D ipmap: makeIPSet: sky.rethinkdns.com, seed: [172.67.214.246 104.21.83.62 2606:4700:3030::ac43:d6f6 2606:4700:3030::6815:533e], typ: Regular
D  onQuery: rcvd query: sky.rethinkdns.com, qtype: 65
E  runtime: newstack at runtime.printlock+0x78 sp=0x40001dd0e0 stack=[0x40001dc000, 0x40001de000]
E  	morebuf={pc:0x7c56751e10 sp:0x40001dd0e0 lr:0x0}
E  	sched={pc:0x7c56784de8 sp:0x40001dd0e0 lr:0x7c56751e10 ctxt:0x0}
E  runtime.callbackUpdateSystemStack(0x4000205508, 0x7be4cbb890, 0x0)
E  runtime: newstack at runtime.printlock+0x78 sp=0x40001dd0e0 stack=[0x40001dc000, 0x40001de000]
E  	/home/jitpack/golang/go/src/runtime/cgocall.go:257 +0x90 fp=0x40001dd140 sp=0x40001dd0e0 pc=0x7c56751e10
E  	morebuf={pc:0x7c56751e10 sp:0x40001dd0e0 lr:0x0}
E  runtime.cgocallbackg(0x7c56cf4d70, 0x7be4cbb980, 0x0)
E  	sched={pc:0x7c56784de8 sp:0x40001dd0e0 lr:0x7c56751e10 ctxt:0x0}
E  runtime.callbackUpdateSystemStack(0x4000205508, 0x7be4cbb890, 0x0)
E  	/home/jitpack/golang/go/src/runtime/cgocall.go:257 +0x90 fp=0x40001dd140 sp=0x40001dd0e0 pc=0x7c56751e10
E  	/home/jitpack/golang/go/src/runtime/cgocall.go:322 +0x68 fp=0x40001dd190 sp=0x40001dd140 pc=0x7c56751fd8
E  runtime.cgocallbackg(0x7c56cf4d70, 0x7be4cbb980, 0x0)
E  	/home/jitpack/golang/go/src/runtime/cgocall.go:322 +0x68 fp=0x40001dd190 sp=0x40001dd140 pc=0x7c56751fd8
E  runtime.cgocallbackg(0x7c56cf4d70, 0x7be4cbb980, 0x0)
E  runtime.cgocallbackg(0x7c56cf4d70, 0x7be4cbb980, 0x0)
E  	<autogenerated>:1 +0x1c fp=0x40001dd1c0 sp=0x40001dd190 pc=0x7c567c552c
E  	<autogenerated>:1 +0x1c fp=0x40001dd1c0 sp=0x40001dd190 pc=0x7c567c552c
E  runtime.cgocallback(0x40001dd238, 0x7c56cd6844, 0x7c56d07de0)
E  runtime.cgocallback(0x40001dd238, 0x7c56cd6844, 0x7c56d07de0)
E  	/home/jitpack/golang/go/src/runtime/asm_arm64.s:1131 +0xb0 fp=0x40001dd1f0 sp=0x40001dd1c0 pc=0x7c567c38a0
E  	/home/jitpack/golang/go/src/runtime/asm_arm64.s:1131 +0xb0 fp=0x40001dd1f0 sp=0x40001dd1c0 pc=0x7c567c38a0
E  runtime.systemstack_switch()
E  runtime.systemstack_switch()
E  	/home/jitpack/golang/go/src/runtime/asm_arm64.s:201 +0x8 fp=0x40001dd200 sp=0x40001dd1f0 pc=0x7c567c1468
E  	/home/jitpack/golang/go/src/runtime/asm_arm64.s:201 +0x8 fp=0x40001dd200 sp=0x40001dd1f0 pc=0x7c567c1468
E  runtime.cgocall(0x7c56d07de0, 0x40001dd278)
E  runtime.cgocall(0x7c56d07de0, 0x40001dd278)
E  	/home/jitpack/golang/go/src/runtime/cgocall.go:185 +0x70 fp=0x40001dd240 sp=0x40001dd200 pc=0x7c567b5250
E  	/home/jitpack/golang/go/src/runtime/cgocall.go:185 +0x70 fp=0x40001dd240 sp=0x40001dd200 pc=0x7c567b5250
E  main._Cfunc_cproxyintra_Bridge_OnQuery(0x2a, {0x7be9d733b0, 0x24, {0x0, 0x0, 0x0, 0x0}}, 0x41)
E  main._Cfunc_cproxyintra_Bridge_OnQuery(0x2a, {0x7be9d733b0, 0x24, {0x0, 0x0, 0x0, 0x0}}, 0x41)
E  	/tmp/gomobile-work-1435465386/go-build113348654/b001/_cgo_gotypes.go:1808 +0x34 fp=0x40001dd270 sp=0x40001dd240 pc=0x7c56cd6844
E  	/tmp/gomobile-work-1435465386/go-build113348654/b001/_cgo_gotypes.go:1808 +0x34 fp=0x40001dd270 sp=0x40001dd240 pc=0x7c56cd6844
E  main.(*proxyintra_Bridge).OnQuery.func1(0x400001e54c, {0x7be9d733b0, 0x24, {0x0, 0x0, 0x0, 0x0}}, 0x41)
E  main.(*proxyintra_Bridge).OnQuery.func1(0x400001e54c, {0x7be9d733b0, 0x24, {0x0, 0x0, 0x0, 0x0}}, 0x41)
E  	/tmp/gomobile-work-1435465386/src/gobind/go_intramain.go:487 +0x84 fp=0x40001dd2d0 sp=0x40001dd270 pc=0x7c56ce6d84
E  	/tmp/gomobile-work-1435465386/src/gobind/go_intramain.go:487 +0x84 fp=0x40001dd2d0 sp=0x40001dd270 pc=0x7c56ce6d84
E  main.(*proxyintra_Bridge).OnQuery(0x400001e54c, {0x40000c8528?, 0x24?}, 0x41)
E  main.(*proxyintra_Bridge).OnQuery(0x400001e54c, {0x40000c8528?, 0x24?}, 0x41)
E  	/tmp/gomobile-work-1435465386/src/gobind/go_intramain.go:487 +0x4c fp=0x40001dd310 sp=0x40001dd2d0 pc=0x7c56ce6c8c
E  	/tmp/gomobile-work-1435465386/src/gobind/go_intramain.go:487 +0x4c fp=0x40001dd310 sp=0x40001dd2d0 pc=0x7c56ce6c8c
E  github.com/celzero/firestack/intra/dnsx.(*resolver).forward(0x40001284e0, {0x400011af30, 0x24, 0x25}, {0x4000398660, 0x1, 0x1})
E  github.com/celzero/firestack/intra/dnsx.(*resolver).forward(0x40001284e0, {0x400011af30, 0x24, 0x25}, {0x4000398660, 0x1, 0x1})
E  	/home/jitpack/build/intra/dnsx/transport.go:416 +0x468 fp=0x40001dd5c0 sp=0x40001dd310 pc=0x7c56b4ecc8
E  	/home/jitpack/build/intra/dnsx/transport.go:416 +0x468 fp=0x40001dd5c0 sp=0x40001dd310 pc=0x7c56b4ecc8
E  github.com/celzero/firestack/intra/dnsx.(*resolver).LocalLookup(0x40001284e0, {0x400011af30, 0x24, 0x25})
E  github.com/celzero/firestack/intra/dnsx.(*resolver).LocalLookup(0x40001284e0, {0x400011af30, 0x24, 0x25})
E  	/home/jitpack/build/intra/dnsx/transport.go:355 +0xd8 fp=0x40001dd660 sp=0x40001dd5c0 pc=0x7c56b4e628
E  	/home/jitpack/build/intra/dnsx/transport.go:355 +0xd8 fp=0x40001dd660 sp=0x40001dd5c0 pc=0x7c56b4e628
E  github.com/celzero/firestack/intra/dnsx.Resolver.LocalLookup-fm({0x400011af30?, 0x7c56e99220?, 0x40000c8510?})
E  github.com/celzero/firestack/intra/dnsx.Resolver.LocalLookup-fm({0x400011af30?, 0x7c56e99220?, 0x40000c8510?})
E  	<autogenerated>:1 +0x44 fp=0x40001dd690 sp=0x40001dd660 pc=0x7c56c3f664
E  	<autogenerated>:1 +0x44 fp=0x40001dd690 sp=0x40001dd660 pc=0x7c56c3f664
E  github.com/celzero/firestack/intra/core.(*Barrier[...]).Do1(0x7c56e99220, {0x40000c8510, 0x16}, 0x40001dd7b0, {0x400011af30, 0x24, 0x25})
E  github.com/celzero/firestack/intra/core.(*Barrier[...]).Do1(0x7c56e99220, {0x40000c8510, 0x16}, 0x40001dd7b0, {0x400011af30, 0x24, 0x25})
E  	/home/jitpack/build/intra/core/barrier.go:138 +0x1d8 fp=0x40001dd6d0 sp=0x40001dd690 pc=0x7c56c3eec8
E  	/home/jitpack/build/intra/core/barrier.go:138 +0x1d8 fp=0x40001dd6d0 sp=0x40001dd690 pc=0x7c56c3eec8
E  github.com/celzero/firestack/intra/dns53.(*ipmapper).Lookup(0x400023c4e0, {0x400011af30, 0x24, 0x25})
E  github.com/celzero/firestack/intra/dns53.(*ipmapper).Lookup(0x400023c4e0, {0x400011af30, 0x24, 0x25})
E  	/home/jitpack/build/intra/dns53/ipmapper.go:84 +0x1d4 fp=0x40001dd7f0 sp=0x40001dd6d0 pc=0x7c56c35314
E  	/home/jitpack/build/intra/dns53/ipmapper.go:84 +0x1d4 fp=0x40001dd7f0 sp=0x40001dd6d0 pc=0x7c56c35314
E  github.com/celzero/firestack/intra/protect/ipmap.(*ipmap).Lookup(0x40001dd910?, {0x400011af30?, 0x13?, 0x7c56730041?})
E  github.com/celzero/firestack/intra/protect/ipmap.(*ipmap).Lookup(0x40001dd910?, {0x400011af30?, 0x13?, 0x7c56730041?})
E  	/home/jitpack/build/intra/protect/ipmap/ipmap.go:182 +0x30 fp=0x40001dd820 sp=0x40001dd7f0 pc=0x7c56b1afa0
E  	/home/jitpack/build/intra/protect/ipmap/ipmap.go:182 +0x30 fp=0x40001dd820 sp=0x40001dd7f0 pc=0x7c56b1afa0
E  github.com/celzero/firestack/intra/dialers.ECH({0x4007ce9c58, 0x12})
E  github.com/celzero/firestack/intra/dialers.ECH({0x4007ce9c58, 0x12})
E  	/home/jitpack/build/intra/dialers/ips.go:130 +0xcc fp=0x40001dd9a0 sp=0x40001dd820 pc=0x7c56b1f0cc
E  	/home/jitpack/build/intra/dialers/ips.go:130 +0xcc fp=0x40001dd9a0 sp=0x40001dd820 pc=0x7c56b1f0cc
E  github.com/celzero/firestack/intra/doh.(*transport).ech(0x4008741f04?)
E  github.com/celzero/firestack/intra/doh.(*transport).ech(0x4008741f04?)
E  	/home/jitpack/build/intra/doh/doh.go:258 +0x90 fp=0x40001dda40 sp=0x40001dd9a0 pc=0x7c56c67020
E  	/home/jitpack/build/intra/doh/doh.go:258 +0x90 fp=0x40001dda40 sp=0x40001dd9a0 pc=0x7c56c67020
E  github.com/celzero/firestack/intra/doh.newTransport({0x7c56630d14, 0xe}, {0x4008741f04, 0x9}, {0x4007ce9c50, 0x24}, {0x0, 0x0}, {0x4000336ec0, 0x4, ...}, ...)
E  github.com/celzero/firestack/intra/doh.newTransport({0x7c56630d14, 0xe}, {0x4008741f04, 0x9}, {0x4007ce9c50, 0x24}, {0x0, 0x0}, {0x4000336ec0, 0x4, ...}, ...)
E  	/home/jitpack/build/intra/doh/doh.go:208 +0x9e0 fp=0x40001ddc20 sp=0x40001dda40 pc=0x7c56c66860
E  	/home/jitpack/build/intra/doh/doh.go:208 +0x9e0 fp=0x40001ddc20 sp=0x40001dda40 pc=0x7c56c66860
E  github.com/celzero/firestack/intra/doh.NewTransport(...)
E  github.com/celzero/firestack/intra/doh.NewTransport(...)
E  	/home/jitpack/build/intra/doh/doh.go:110
E  	/home/jitpack/build/intra/doh/doh.go:110
E  github.com/celzero/firestack/intra.AddDoHTransport({0x7c56e96a60, 0x40002d87e0}, {0x4008741f04, 0x9}, {0x4007ce9c50, 0x24}, {0x4008758000, 0x4f})
E  github.com/celzero/firestack/intra.AddDoHTransport({0x7c56e96a60, 0x40002d87e0}, {0x4008741f04, 0x9}, {0x4007ce9c50, 0x24}, {0x4008758000, 0x4f})
E  	/home/jitpack/build/intra/dns.go:166 +0x178 fp=0x40001ddd60 sp=0x40001ddc20 pc=0x7c56cc3f68
E  	/home/jitpack/build/intra/dns.go:166 +0x178 fp=0x40001ddd60 sp=0x40001ddc20 pc=0x7c56cc3f68
E  main.proxyintra__AddDoHTransport(0xffffffd4, {0x7cc8d974e0, 0x9, {0x0, 0x0, 0x0, 0x0}}, {0x7cd847dba0, 0x24, {0x0, ...}}, ...)
E  main.proxyintra__AddDoHTransport(0xffffffd4, {0x7cc8d974e0, 0x9, {0x0, 0x0, 0x0, 0x0}}, {0x7cd847dba0, 0x24, {0x0, ...}}, ...)
E  	/tmp/gomobile-work-1435465386/src/gobind/go_intramain.go:1177 +0xc0 fp=0x40001ddde0 sp=0x40001ddd60 pc=0x7c56ce9a20
E  	/tmp/gomobile-work-1435465386/src/gobind/go_intramain.go:1177 +0xc0 fp=0x40001ddde0 sp=0x40001ddd60 pc=0x7c56ce9a20
E  _cgoexp_61136d50f02e_proxyintra__AddDoHTransport(0x7be4cc04d0)
E  _cgoexp_61136d50f02e_proxyintra__AddDoHTransport(0x7be4cc04d0)
E  	/tmp/gomobile-work-1435465386/go-build113348654/b001/_cgo_gotypes.go:6139 +0x58 fp=0x40001dde60 sp=0x40001ddde0 pc=0x7c56cf7808
E  	/tmp/gomobile-work-1435465386/go-build113348654/b001/_cgo_gotypes.go:6139 +0x58 fp=0x40001dde60 sp=0x40001ddde0 pc=0x7c56cf7808
E  runtime.cgocallbackg1(0x7c56cf77b0, 0x7be4cc04d0, 0x0)
E  runtime.cgocallbackg1(0x7c56cf77b0, 0x7be4cc04d0, 0x0)
E  	/home/jitpack/golang/go/src/runtime/cgocall.go:437 +0x21c fp=0x40001ddf30 sp=0x40001dde60 pc=0x7c5675230c
E  	/home/jitpack/golang/go/src/runtime/cgocall.go:437 +0x21c fp=0x40001ddf30 sp=0x40001dde60 pc=0x7c5675230c
E  runtime.cgocallbackg(0x7c56cf77b0, 0x7be4cc04d0, 0x0)
E  runtime.cgocallbackg(0x7c56cf77b0, 0x7be4cc04d0, 0x0)
E  	/home/jitpack/golang/go/src/runtime/cgocall.go:356 +0xf4 fp=0x40001ddf80 sp=0x40001ddf30 pc=0x7c56752064
E  	/home/jitpack/golang/go/src/runtime/cgocall.go:356 +0xf4 fp=0x40001ddf80 sp=0x40001ddf30 pc=0x7c56752064
E  runtime.cgocallbackg(0x7c56cf77b0, 0x7be4cc04d0, 0x0)
E  runtime.cgocallbackg(0x7c56cf77b0, 0x7be4cc04d0, 0x0)
E  	<autogenerated>:1 +0x1c fp=0x40001ddfb0 sp=0x40001ddf80 pc=0x7c567c552c
E  	<autogenerated>:1 +0x1c fp=0x40001ddfb0 sp=0x40001ddf80 pc=0x7c567c552c
E  runtime.cgocallback(0x0, 0x0, 0x0)
E  runtime.cgocallback(0x0, 0x0, 0x0)
E  	/home/jitpack/golang/go/src/runtime/asm_arm64.s:1131 +0xb0 fp=0x40001ddfe0 sp=0x40001ddfb0 pc=0x7c567c38a0
E  	/home/jitpack/golang/go/src/runtime/asm_arm64.s:1131 +0xb0 fp=0x40001ddfe0 sp=0x40001ddfb0 pc=0x7c567c38a0
E  runtime.goexit({})
E  runtime.goexit({})
E  	/home/jitpack/golang/go/src/runtime/asm_arm64.s:1223 +0x4 fp=0x40001ddfe0 sp=0x40001ddfe0 pc=0x7c567c3994
E  	/home/jitpack/golang/go/src/runtime/asm_arm64.s:1223 +0x4 fp=0x40001ddfe0 sp=0x40001ddfe0 pc=0x7c567c3994
E  fatal error: runtime: stack split at bad time
E  fatal error: runtime: stack split at bad time
@ignoramous
Copy link
Contributor

Possible cause:

These problems are happening because the duktape library calls setjmp and longjmp. When calling C code from Go, you can only use setjmp/longjmp within a single C call that does not make any intervening Go calls. Specifically, the call to ctx.RequireNumber is failing and trying to call longjmp to a setjmp that occurred before calling back into Go to invoke func. That can't work. The longjmp is skipping over the intervening Go code.

I think the status right now is that you can use duktape from Go as long as you are careful to not cause any errors. I recommend modifying the duktape code to crash on error rather than calling longjmp.

I'm going to close this issue because I don't think there is anything we can do to fix it.

golang/go#15639 (comment)

@ignoramous ignoramous changed the title fatal error during app installation gomobile: fatal error: stack split at bad time Aug 19, 2024
ignoramous referenced this issue Aug 20, 2024
In go1.23, JNI calls into Go calling back into JNI result in a runtime crash.
For some of the common APIs (intra.Bridge) calling into JNI, do so in a
separate go routine (DNSListener.OnQuery, SocketListener.Flow, Console.Log).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants