Re: [go-nuts] cgo and fatal: morestack on g0

2021-09-10 Thread Ian Lance Taylor
On Thu, Aug 26, 2021 at 4:56 AM Miha Vrhovnik  wrote:
>
> we are using a library via CGO that is the emulator for a real device.
> That library also contains a javascript engine which calls to Go for 
> communication to the outside world. The problem we are facing is that we are 
> getting more and more crashes with "morestack on g0".
> I have found tickets on the go github (for windows) that show that this 
> occurs where go is out of stack. When looking at the gdb bt, the callstack 
> doesn't seem so deep.
> And before anyone asks, yes the call stack looks like this  
> go->c->c->.->c->go (crash).
>
> The main is locked to the Os thread with runtime.LockOSThread() however 
> removing this doesn't help.
>
> Is there any chance of upping up the available stack in CGO cases.
>
> The behavior is the same on 1.16.7 and newly released 1.17.

You didn't mention what kind of system you are using.  When a Go
program uses cgo, the C threads will be created with the default stack
size for that system.  Many systems have a way to configure this value
independently of the program.  For example, on Linux, use ulimit -s.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcV_LRYMwbW7-tasp3zt05Z24h_w3ExEEjb6EZOf5LoAkQ%40mail.gmail.com.


[go-nuts] cgo and fatal: morestack on g0

2021-08-26 Thread Miha Vrhovnik

Hey,

we are using a library via CGO that is the emulator for a real device. 
That library also contains a javascript engine which calls to Go for 
communication to the outside world. The problem we are facing is that we 
are getting more and more crashes with "morestack on g0". 
I have found tickets on the go github (for windows) that show that this 
occurs where go is out of stack. When looking at the gdb bt, the callstack 
doesn't seem so deep. 
And before anyone asks, yes the call stack looks like this  
go->c->c->.->c->go (crash).

The main is locked to the Os thread with runtime.LockOSThread() however 
removing this doesn't help.

Is there any chance of upping up the available stack in CGO cases.

The behavior is the same on 1.16.7 and newly released 1.17.

BR,
Miha

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/01278325-357b-4ec5-95a2-d126bd38009dn%40googlegroups.com.