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

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

xiaoxiaoyijian opened this issue Aug 5, 2016 · 25 comments
Assignees
Milestone

Comments

@xiaoxiaoyijian
Copy link

@xiaoxiaoyijian xiaoxiaoyijian commented Aug 5, 2016

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

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Aug 5, 2016

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

This comment has been minimized.

Copy link
Author

@xiaoxiaoyijian xiaoxiaoyijian commented Aug 5, 2016

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

This comment has been minimized.

Copy link
Contributor

@bradfitz 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

This comment has been minimized.

Copy link
Author

@xiaoxiaoyijian xiaoxiaoyijian commented Aug 5, 2016

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

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Aug 5, 2016

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Aug 5, 2016

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

@xiaoxiaoyijian

This comment has been minimized.

Copy link
Author

@xiaoxiaoyijian xiaoxiaoyijian commented Aug 5, 2016

OK, thanks.

@bradfitz

This comment has been minimized.

Copy link
Contributor

@bradfitz 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

This comment has been minimized.

Copy link
Author

@xiaoxiaoyijian xiaoxiaoyijian commented Aug 5, 2016

Yes, maybe they will fix it in future.

@bradfitz

This comment has been minimized.

Copy link
Contributor

@bradfitz 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

This comment has been minimized.

Copy link

@jstarks 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

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Aug 5, 2016

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

@bradfitz

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Aug 5, 2016

Fine by me.

@benhillis

This comment has been minimized.

Copy link

@benhillis benhillis commented Aug 5, 2016

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

This comment has been minimized.

Copy link
Contributor

@bradfitz 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)
@gopherbot gopherbot closed this in 3a03e87 Aug 5, 2016
madeye added 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>
@iguanae

This comment has been minimized.

Copy link

@iguanae iguanae 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

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Aug 13, 2016

I guess it's not fully implemented yet.

@benhillis

This comment has been minimized.

Copy link

@benhillis benhillis commented Aug 15, 2016

@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

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Aug 15, 2016

@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

This comment has been minimized.

Copy link

@benhillis benhillis commented Aug 15, 2016

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

@stuart-warren

This comment has been minimized.

Copy link

@stuart-warren stuart-warren commented Aug 24, 2016

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

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Aug 24, 2016

@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

This comment has been minimized.

Copy link

@benhillis benhillis commented Sep 13, 2016

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

This comment has been minimized.

Copy link
Contributor

@bradfitz bradfitz commented Sep 13, 2016

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

@benhillis

This comment has been minimized.

Copy link

@benhillis benhillis commented Sep 28, 2016

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.