Skip to content

runtime/cgo: longjmp in CGO code causes a crash on Windows #9754

Closed
@trink

Description

@trink

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

 git clone https://github.com/mozilla-services/heka
 cd heka
 git checkout --track origin/sandbox_refactor
 build.bat
 ctest -V -R sandbox

Output

2/3 Test #24: sandbox ..........................***Failed    0.84 sec
2015/02/02 07:15:08 payload_type: txt
payload_name:
payload: Hello World!
2015/02/02 07:15:08 payload_type: txt
payload_name:
payload: Hello World!
2015/02/02 07:15:08 payload_type: txt
payload_name:
payload: Hello World!
Exception 0xc0000005 0x1 0x3d1a0c 0x778e5bce
PC=0x778e5bce
signal arrived during cgo execution

github.com/mozilla-services/heka/sandbox/lua._Cfunc_process_message(0x2e6cc0, 0xc000000000)
        github.com/mozilla-services/heka/sandbox/lua/_obj/_cgo_gotypes.go:96 +0x4a
github.com/mozilla-services/heka/sandbox/lua.(*LuaSandbox).ProcessMessage(0xc08200c780, 0xc08200c500, 0x27)
        D:/work/heka/build/heka/src/github.com/mozilla-services/heka/sandbox/lua/lua_sandbox.go:618 +0x64
github.com/mozilla-services/heka/sandbox/lua_test.TestAPIErrors(0xc082058240)
        D:/work/heka/build/heka/src/github.com/mozilla-services/heka/sandbox/lua/lua_sandbox_test.go:330 +0x4e0
testing.tRunner(0xc082058240, 0x8ae9d8)
        d:/go/x64/src/testing/testing.go:447 +0xc6
created by testing.RunTests
        d:/go/x64/src/testing/testing.go:555 +0xa92

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions