Skip to content
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

os: waitid: function not implemented on Windows 10(Bash on Ubuntu) #16610

Closed
xiaoxiaoyijian opened this issue Aug 5, 2016 · 25 comments
Closed

Comments

@xiaoxiaoyijian
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version go1.7rc5 linux/amd64
  2. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/steven/gopath"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.

cat hello.go

//hellogolang.go


package main


import (
        "fmt"
)


func main() {
        fmt.Println("Hello Golang!")
}

go build hello.go
go build command-line-arguments: /usr/local/go/pkg/tool/linux_amd64/compile: waitid: function not implemented

  1. What did you expect to see?
    works OK in go1.7rc5
  2. What did you see instead?
    go build hello.go
    go build command-line-arguments: /usr/local/go/pkg/tool/linux_amd64/compile: waitid: function not implemented

But when I switched it to go1.6.3, it works OK.

@ianlancetaylor ianlancetaylor changed the title Found go1.7rc5 issue on Windows 10(Bash on Ubuntu), but go1.6.3 works OK. os: waitid: function not implemented on Windows 10(Bash on Ubuntu) Aug 5, 2016
@ianlancetaylor
Copy link
Contributor

Why do you refers to Windows 10 in the topic?

What Linux version are you running?

@ianlancetaylor ianlancetaylor self-assigned this Aug 5, 2016
@ianlancetaylor ianlancetaylor added this to the Go1.7Maybe milestone Aug 5, 2016
@xiaoxiaoyijian
Copy link
Author

Bash on Ubuntu for Win10

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:        14.04
Codename:       trusty

@bradfitz
Copy link
Contributor

bradfitz commented Aug 5, 2016

Ian, this is Microsoft's implementation of the Linux system calls atop the Window 10 kernel. It's Linux-like. They didn't implement this system call apparently.

@xiaoxiaoyijian
Copy link
Author

go1.6.3 works OK, but go1.7rc5 NOT OK.

@ianlancetaylor
Copy link
Contributor

@gopherbot
Copy link

CL https://golang.org/cl/25507 mentions this issue.

@xiaoxiaoyijian
Copy link
Author

OK, thanks.

@bradfitz
Copy link
Contributor

bradfitz commented Aug 5, 2016

Maybe we should ask Microsoft if they'd rather fix this than us work around it. I believe it's still in development and they're targeting Linux parity. Their goal is Docker stuff iiuc.

@xiaoxiaoyijian
Copy link
Author

Yes, maybe they will fix it in future.

@bradfitz
Copy link
Contributor

bradfitz commented Aug 5, 2016

@jstarks, are you involved with Windows' Linux subsystem? Windows 10 doesn't seem to implement the waitid system call, which Go 1.7 started using. Is that known and going to be fixed? Or should we work around it?

@jstarks
Copy link

jstarks commented Aug 5, 2016

waitid support is tracked here: microsoft/WSL#638. It's not in the stable build of Windows 10 released August 2, so it's unlikely to be widely available to customers in the next several months. Depending on if/when it's implemented, it might be available in a preview release sooner.

cc @benhillis

@ianlancetaylor
Copy link
Contributor

@bradfitz Given the above I'm inclined to submit CL 25507 for the 1.7 release. It's simple and safe.

@bradfitz
Copy link
Contributor

bradfitz commented Aug 5, 2016

Fine by me.

@benhillis
Copy link

WSL has implemented the waitid system call and it will be available in a post Anniversary Update Windows Insider flight. One caveat: the P_PGID IdType is not yet implemented, are you using that?

@bradfitz
Copy link
Contributor

bradfitz commented Aug 5, 2016

@benhillis, nope. Just P_PID:

const _P_PID = 1
....
    // The waitid system call expects a pointer to a siginfo_t,
    // which is 128 bytes on all GNU/Linux systems.
    // On Darwin, it requires greater than or equal to 64 bytes
    // for darwin/{386,arm} and 104 bytes for darwin/amd64.
    // We don't care about the values it returns.
    var siginfo [128]byte
    psig := &siginfo[0]
    _, _, e := syscall.Syscall6(syscall.SYS_WAITID, _P_PID, uintptr(p.Pid), uintptr(unsafe.Pointer(psig)), syscall.WEXITED|syscall.WNOWAIT, 0, 0)

madeye pushed a commit to shadowsocks/go that referenced this issue Aug 10, 2016
Reportedly waitid is not available for Ubuntu on Windows.

Fixes golang#16610.

Change-Id: Ia724f45a85c6d3467b847da06d8c65d280781dcd
Reviewed-on: https://go-review.googlesource.com/25507
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@tirpen
Copy link

tirpen commented Aug 13, 2016

Insiders Build 14901 implemented waitid. Here's the output for 'go build', though:

command-line-arguments: /usr/local/go/pkg/tool/linux_amd64/compile: waitid: invalid argument

This is Go 1.7rc6 linux/amd64. Microsoft/BashOnWindows#638.

@bradfitz
Copy link
Contributor

I guess it's not fully implemented yet.

@benhillis
Copy link

@aschneiderg Do you happen to have an strace of the failing waited system call? We should handle everything except P_PGID IdType but it's possible we missed something.

@bradfitz
Copy link
Contributor

@benhillis, use of waitid occurs exactly once in the Go codebase as of Go 1.7:

        _, _, e := syscall.Syscall6(syscall.SYS_WAITID, _P_PID, uintptr(p.Pid), uintptr(unsafe.Pointer(psig)), syscall.WEXITED|syscall.WNOWAIT, 0, 0)

Where those constants are:

const _P_PID = 1

zsysnum_linux_amd64.go: SYS_WAITID                 = 247

zerrors_linux_amd64.go: WEXITED                          = 0x4
zerrors_linux_amd64.go: WNOWAIT                          = 0x1000000

@benhillis
Copy link

@bradfitz thanks for the pointer. I suspect we aren't handling the nowait flag correctly. I'll take a look this morning.

@stuart-warren
Copy link

Still getting /usr/local/go/pkg/tool/linux_amd64/compile: waitid: invalid argument for go 1.7 final on build 14905 :(

https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/15807382-support-compiling-golang

@bradfitz
Copy link
Contributor

@stuart-warren, the bug you're looking for is microsoft/WSL#638

This is Go's issue tracker and this issue is closed. We're probably not going to go out of our way to support a variant of Linux when that Linux variant is still under development and has a goal to not feel like a variant.

@benhillis
Copy link

FYI I've checked this fix in to WSL and it should be available in an upcoming Windows Insider build. Thanks again for bringing this to my attention.

@bradfitz
Copy link
Contributor

@benhillis, excellent. Thanks for the fix and the update.

@benhillis
Copy link

The fix should be available in Windows version 14936 and later.

microsoft/WSL#638 (comment)

@golang golang locked and limited conversation to collaborators Sep 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants