Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.
1103 Discussions

Go programs (even an empty one) hang on exit



If I compile an empty go program and run it under SDE64 7.49 on Linux, the program does not exit unless I send it multiple signals (4 or 5 SIGINT or SIGQUIT seems to do the trick).

By "empty" I mean a main.go containing "package main; func() main {}".

More detail: If you do a print statement within go, you can see that code does run. It appears to be that just hangs around exit time. It still hangs even if I import "os" and call os.Exit(0), which is a thin wrapper around SYS_exit_group, so go doesn't appear to be doing anything fancy in terms of process wind-down. Go does have a runtime which makes use of threads though, so there could be some poor interaction there.

I would try and diagnose the issue further but neither GDB nor strace do anything useful for me. If this turns out to be an issue with the Go toolchain and you supply any useful details about how the go toolchain needs to change to support SDE (if that is the case), I am willing to follow that up with them upstream.

This is reproducible under go1.8beta2 and go1.7.

If you're unfamiliar with the Go toolchain it is straightforward to run:

1) Obtain binaries or install from source (or install from your distro packages)

2) Choose a directory and set GOPATH=$PWD

3) mkdir -p src/go-sdetest && cd src/go-sdetest

4) Make a file called main.go

5) Run go build. This produces a binary called go-sdetest in the current directory.

Running this binary under SDE should reproduce the hang.



0 Kudos
1 Reply

Thanks for reporting this issue. We are working to fix it.I hope to include the fix in the next SDE update.



0 Kudos