使用其他用户的凭据启动子流程时,Go应用程序挂起

I've been using a simple game server management application on Ubuntu 14.04 for the last 6 months or so. After a recent server update & reboot the application would hang on when trying to start a subprocess. After some debugging it seems that whenever I try to start a subprocess with another user's credentials (I'm running as a root) any command will hang.

Here's a simple application to demonstrate what causes the hang:

package main
import (
    "os/exec"
    "syscall"
    "fmt"
)

func main() {
    proc := exec.Command("ls")

    proc.SysProcAttr = &syscall.SysProcAttr{}
    proc.SysProcAttr.Credential = &syscall.Credential{Uid: 1022, Gid: 1023}
    err := proc.Run()
    if err != nil {
        fmt.Printf("err: %v", err)
    }
}

By removing the syscall.Credential part, the application will run without any issues.

My question is: is there some platform/update specific reason that causes this behaviour? Is this no longer a correct way to run a subprocess as another user?

EDIT: Here's the last 5 lines of strace -f

[pid  3994] futex(0xc21000a888, FUTEX_WAKE, 1 <unfinished ...>
[pid  3995] <... futex resumed> )       = 0
[pid  3994] <... futex resumed> )       = 1
[pid  3995] futex(0xc21000a888, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid  3994] select(0, NULL, NULL, NULL, {0, 20}) = 0 (Timeout)
[pid  3994] futex(0x7f615c51a4f8, FUTEX_WAIT, 0, NULL

So apparently if I'm interpreting this right it's blocking at futex_wait.

You should execute your application with strace. So strace myapp and see where it locks up. It could be you have something else that's forking before your application executes, which is causing it to hang.