-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: buildmode=c-shared segfaults with CGo + Go1.5 (and Go1.5.1) #12582
Comments
valgrind doesn't work on Go programs. Your valgrind trace shows that the Go code is crashing because of valgrind. So that really doesn't tell us much. Can you describe the crashes that you get when not running valgrind? Do you get any kind of stack trace? Can you run the crashing program under a debugger and get a stack trace that way? |
Running it under gdb gives me the following stack:
|
Thanks, but unfortunately that's pretty useless. It tells us that the segmentation violation is occurring somewhere in C code. Can you find out at what stage in your process the crash occurs? Does "DROP FUNCTION hello;" call dlclose? Because you can't call dlclose on a Go shared library. |
Yes, dlcose() is called by mysqld on DROP FUNCTION. |
The crash is pretty random. The following happened on CREATE FUNCTION this time:
|
Any suggestion on how to decipher the '??'. ? On DROP FUNCTION with a breakpoint on dlopen:
The segfault happens in a separate thread. |
A SIGINT signal is not caused by your program, unless your program explicitly calls raise(SIGINT) or kill(getpid(), SIGINT). A SIGINT normally comes from hitting ^C. |
Calling dlclose on a Go shared library is just flat out not going to work. Digging into the details is of only academic interest. The first step to figuring out the ?? is to use "info sharedlibrary" to find out which shared library those addresses are in. |
^C could be from my weird touchpad. Sorry about that. |
Those aren't stack addresses, they are PC addresses. For them to not be in any of the shared libraries is approximately impossible. However, if they are not, then the next step is to look for the addresses in /proc/PID/maps. |
go version go1.5.1 linux/amd64
Linux nirbhay-VirtualBox-1 3.13.0-63-generic Undefined reference "elm" in godocs.js:16 #103-Ubuntu SMP Fri Aug 14 21:42:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
(a) Install MariaDB server
(b) Build User defined function (UDF) shared object file and copy it under /usr/lib/mysql/plugin/
Code: http://play.golang.org/p/RN7R3M_wzt
Build: go build -buildmode=c-shared -o hello.so src/hello/hello.go
(c) Using mysql client connect to the mysqld server and run the following command
The hello() function should print "world".
Frequent crashes.
Under valgrind
Full output : http://pastie.org/10411289
Discussion : https://groups.google.com/forum/#!topic/golang-nuts/_HNmB3oHnl8
The text was updated successfully, but these errors were encountered: