wrong goroutine in newstack (Julia)

321 views
Skip to first unread message

Ben Johnson

unread,
Nov 19, 2013, 4:41:04 PM11/19/13
to golang-nuts
I'm currently trying to write bindings to the Julia language from Go. I know, it sounds like a weird thing to do but I actually have a use case for it. :)

I'm hitting a problem where after I initialize Julia, I receive a "fatal error: wrong goroutine in newstack":

https://gist.github.com/benbjohnson/d705d7339a2e08b02f49

Here's the tiny bit of code so far:

https://gist.github.com/benbjohnson/549acd1f19d2ee81aea7

I'm guessing LLVM is doing some kind of allocation that messes with the Go stack but I don't know enough about runtime/stack.c to make that call.

Can anyone point me in the right direction of where I can look next or tell me what might be going on?


Ben Johnson



Ian Lance Taylor

unread,
Nov 19, 2013, 5:57:01 PM11/19/13
to Ben Johnson, golang-nuts
I have no idea what is happening. That error is (of course)
impossible.

It might help to set the environment variable GOTRACEBACK=2 to make
sure you are seeing all the stack frames. Because right now the stack
seems to end at morestack, which does not make sense.

In general you need to find out what is calling morestack, and how.

Ian

Dmitry Vyukov

unread,
Nov 20, 2013, 4:55:38 AM11/20/13
to Ben Johnson, golang-nuts
Morestack is called from gsignal, which is signal handling goroutine.
Your external C code seem to mess with signal handlers/sigaltstack.
This won't work with Go.
> --
> 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...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

stefan.k...@gmail.com

unread,
Nov 20, 2013, 10:32:07 AM11/20/13
to golan...@googlegroups.com
This is unlikely to work well since both Julia and Go are doing unusual things with the stack – Go to implement goroutines and Julia to implement its coroutines. That's a bit of a shame, since it would be nice to be able to call Julia code from anywhere. If you raise the issue on the Julia mailing list, maybe we can figure out how to generate coroutine-free Julia code using jlapi.c.
Reply all
Reply to author
Forward
0 new messages