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
runtime: load two go so/DLLs in one c++ executable on Windows #36628
Comments
As far as I know this should be possible, but I'm not at all surprised that it does not work. Can you give us a standalone test case that demonstrates the problem? Thanks. |
Thanks for replying!
Every go DLL ships with a golang runtime, I'm curious how they work together? Is there any way to strip away one of them?
I don't know if a simple test case can reproduce this problem. In golang side, it involves net, channel, goroutine, protobuf, log, encoding/json, etc. And golang/c++ have two-way communications(c++ calls golang, golang calls c++ too). Any of these can go wrong. I don't even know how to trigger the crash, quite random. But I will try. |
On Unix systems, we use symbol visibility so that although each shared object has a copy of the Go runtime, the two runtimes are independent. In effect you get two entirely different Go worlds. I don't know how that kind of symbol visibility works on Windows. |
Got it. I think windows has the equivalent concept, just working in the opposite way. If you don't explicitly export symbols, they are confined in your own mem space. So you are right, it should work here. Looks like I have to dig more information before blaming it on the go part. |
After weeks of debugging, we have finally found the bug, it is not related to coexisting of two golang libraries. Multiple golang dlls can work properly even on Windows. |
Thanks for following up. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
not sure
What operating system and processor architecture are you using (
go env
)?Windows 10 1903
CentOS 7.2
What did you do?
I wrote two different components in golang and compiled them into C dynamic libraries.
Then built a c++ executable with these two dynamic libraries.
Both these libraries have a running goroutine receiving msg from net and call back c++ functions(not the same one though) to notify events.
In the test environment with a light workload, everything works all right.
But when it comes to heavy load production env, it crashes randomly!
Sometimes I can get exception infomation from stderr saying runtime: unknown pc ,
other times it just simply crashes.
I've carefully checked c++ layer and didn't see any suspicious part (c++ layer is quite simple).
And I also notice that windows is more vulnerable. Rarely see it crashes on Linux.
So I wonder if the problem is coming from the go part.
Can two go shared libraries really coexist together in one process???
If not, How can I solve this?? I don't wanna rewrite everything!
What did you expect to see?
Running normally.
What did you see instead?
randomly crashes
sometimes get exception report like following one.
The text was updated successfully, but these errors were encountered: