-
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/cgo: longjmp in CGO code causes a crash on Windows #9754
Comments
Can you write a standalone test case? I can imagine several ways that longjmp will fail horribly in a Go program, but without knowing what Lua is doing here I don't know whether it can be expected to work or not. |
Sadly, I haven't had any luck. The unit test I provided is now reproducing the problem consistently but even this code was running successfully with a slightly different verison of the lua.dll (some patches were appiled, but there were no modifications to the error handling routines) |
@trink please try https://go-review.googlesource.com/#/c/5711/ see if it helps your problem. I don't have all mingw tools installed to try it myself. Alex |
Still seeing the same issue. go version devel +ad3a99c Tue Feb 24 15:00:34 2015 +1100 windows/amd64
|
Fair enough. Thanks for trying. Alex |
Does it also crash on say Linux or OS X, or just Windows? |
Nope, not an issue on OSX or Linux, only Windows. |
@rafrombrc have you tried current tip? @minux made big changes to windows cgo recently. Alex |
Last try was using code from here. I'll try tip and see i that makes a difference. |
Please try current tip. Thank you. Alex |
If the external linking change fixes the problem then it's great. Without looking at the source code, I can't be sure whether the On the plus side, as Lua's longjmp based error handling is portable, Please try again with the current tip. Thanks. |
Okay, I've tried the current tip (go version devel +399b3e3 Fri Apr 10 22:51:46 2015 +0000 windows/amd64). Unfortunately, I can't tell whether or not it resolved the original issue, because now I'm hitting a compiler error, it's panicking while trying to compile the executable. I've verified that it's only happening on Windows; on Linux everything compiles and the tests all pass. |
did you pass some custom ldflags? |
Yes, the general LDFLAGS value used was |
-s triggers a known bug (#10254) in that code, remove it and test again
please.
|
Okay, removed the LDFLAGS Comparing that with what the original output @trink pasted above, you can see that the crash is happening later in the text execution. All of the |
this seems to have gone quiet ... any updates? |
@johnjelinek From quick glance your CGO code crashes, uninitialised lua_sandbox handle is passed to process_message, which is the reason of said crash. Looking at the test code, especially ignored error here and here seems to confirm the theory. You may want to rewrite the test to not crash, and then eventually figure out the reason why it fails. [edit] fixed links |
It sounds like the longjmp is fixed, and now there is a problem in the test. Is that right? |
As Russ says, it sounds like this problem is fixed. I'm going to close it. But please do reopen the issue if you can recreate it. |
Confirmed, the test no longer cores in Go 1.5 Beta 2 |
System Info
Go: 1.4.1
OS: Windows 7 64bit
Compiler gcc (tdm64-1) 4.7.1
This problem is not new to 1.4 but changes to the libraries being linked can cause the problem to appear/disappear.
Steps to reproduce
Output
The failure occurs on line https://github.com/mozilla-services/heka/blob/sandbox_refactor/sandbox/lua/lua_sandbox_interface.c#L170 where luaL_error long jumps.
Observation: Adding a return statement to the line changes the behavior but it did not prove to be a viable workaround.
The text was updated successfully, but these errors were encountered: