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

runtime: time.Sleep() never returns on macOS Sierra beta2 #16382

Closed
zhaytee opened this issue Jul 15, 2016 · 3 comments
Closed

runtime: time.Sleep() never returns on macOS Sierra beta2 #16382

zhaytee opened this issue Jul 15, 2016 · 3 comments

Comments

@zhaytee
Copy link

zhaytee commented Jul 15, 2016

This wasn't happening on my machine before I installed the macOS beta. Kind of regretting it now! 😁

  1. What version of Go are you using?
    go version go1.6.2 darwin/amd64
  2. What operating system and processor architecture are you using?
    macOS Sierra beta2 (macOS 10.12 16A238m)
    on amd64
  3. What did you do?
    Compiled and ran the following small program:
package main

import (
    "fmt"
    "time"
)

func main() {
    i := 0
    for {
        i++
        fmt.Printf("Sleeping, pass #%d... ", i)
        time.Sleep(time.Millisecond * 50)
        fmt.Printf("done.\n")
    }
}
  1. What did you expect to see?
    A practically infinite number of loop iterations.
  2. What did you see instead?
    Output for a few seconds, then nothing, because time.Sleep() fails to return after a few iterations of the loop.
    Using a debugger (https://github.com/derekparker/delve), I'm able to interrupt the program and grab a stack trace when it freezes, and it's always exactly the same:
0  0x0000000000056c43 in runtime.mach_semaphore_timedwait
   at /usr/local/go/src/runtime/sys_darwin_amd64.s:421
1  0x0000000000026d0b in runtime.semasleep1
   at /usr/local/go/src/runtime/os1_darwin.go:412
2  0x000000000004b250 in runtime.semasleep.func1
   at /usr/local/go/src/runtime/os1_darwin.go:439
3  0x0000000000053597 in runtime.systemstack
   at /usr/local/go/src/runtime/asm_amd64.s:291
4  0x000000000002d390 in runtime.startTheWorldWithSema
   at /usr/local/go/src/runtime/proc.go:986
5  0x0000000000183600 in (nil)
   at ?:-1

I get the same result if the for loop is moved into a separate goroutine, or if the sleep duration is varied.

@cespare
Copy link
Contributor

cespare commented Jul 15, 2016

Duplicate of #16272

@mikioh
Copy link
Contributor

mikioh commented Jul 15, 2016

Merged into #16354.

@mikioh mikioh closed this as completed Jul 15, 2016
@mikioh mikioh changed the title time.Sleep() never returns time: Sleep() never returns on macOS Sierra beta2 Jul 15, 2016
@bradfitz
Copy link
Contributor

Dup of #16272
On Jul 14, 2016 6:14 PM, "Joe Toscano" notifications@github.com wrote:

This wasn't happening on my machine before I installed the macOS beta.
Kind of regretting it now! 😁

What version of Go are you using?
go version go1.6.2 darwin/amd64
2.

What operating system and processor architecture are you using?
macOS Sierra beta2 (macOS 10.12 16A238m)
on amd64
3.

What did you do?
Compiled and ran the following small program:

package main

import (
"fmt"
"time"
)

func main() {
i := 0
for {
i++
fmt.Printf("Sleeping, pass #%d... ", i)
time.Sleep(time.Millisecond * 50)
fmt.Printf("done.\n")
}
}

What did you expect to see?
A practically infinite number of loop iterations.
2.

What did you see instead?
Output for a few seconds, then nothing, because time.Sleep() fails to
return after a few iterations of the loop.
Using a debugger (https://github.com/derekparker/delve), I'm able to
interrupt the program and grab a stack trace when it freezes, and it's
always exactly the same:

0 0x0000000000056c43 in runtime.mach_semaphore_timedwait
at /usr/local/go/src/runtime/sys_darwin_amd64.s:421
1 0x0000000000026d0b in runtime.semasleep1
at /usr/local/go/src/runtime/os1_darwin.go:412
2 0x000000000004b250 in runtime.semasleep.func1
at /usr/local/go/src/runtime/os1_darwin.go:439
3 0x0000000000053597 in runtime.systemstack
at /usr/local/go/src/runtime/asm_amd64.s:291
4 0x000000000002d390 in runtime.startTheWorldWithSema
at /usr/local/go/src/runtime/proc.go:986
5 0x0000000000183600 in (nil)
at ?:-1

I get the same result if the for loop is moved into a separate goroutine,
or if the sleep duration is varied.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#16382, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAKPcJy2TABXENnMPgeDKzC9Xl7o6_Eks5qVt7VgaJpZM4JM_hS
.

@mikioh mikioh changed the title time: Sleep() never returns on macOS Sierra beta2 runtime: time.Sleep() never returns on macOS Sierra beta2 Oct 13, 2016
@golang golang locked and limited conversation to collaborators Oct 13, 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

5 participants