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

tail.Stop() throws "all goroutines are asleep - deadlock!" #93

Closed
skaji opened this issue Jun 30, 2016 · 0 comments · Fixed by nxadm/tail#7
Closed

tail.Stop() throws "all goroutines are asleep - deadlock!" #93

skaji opened this issue Jun 30, 2016 · 0 comments · Fixed by nxadm/tail#7

Comments

@skaji
Copy link

skaji commented Jun 30, 2016

The following code reproduces this.

// test.go
package main

import (
    "github.com/hpcloud/tail"
    "io/ioutil"
)

func main() {
    ioutil.WriteFile("test.log", []byte("hoge\n"), 0644)
    t, _ := tail.TailFile("test.log", tail.Config{})
    t.Stop()
}
> go run test.go
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
github.com/hpcloud/tail/vendor/gopkg.in/tomb%2ev1.(*Tomb).Wait(0xc82007a078, 0x0, 0x0)
    /Users/skaji/src/github.com/hpcloud/tail/vendor/gopkg.in/tomb.v1/tomb.go:113 +0x58
github.com/hpcloud/tail.(*Tail).Stop(0xc82007a000, 0x0, 0x0)
    /Users/skaji/src/github.com/hpcloud/tail/tail.go:164 +0x5f
main.main()
    /Users/skaji/test.go:12 +0xee

goroutine 5 [chan send]:
github.com/hpcloud/tail.(*Tail).sendLine(0xc82007a000, 0xc82000a420, 0x4, 0x0)
    /Users/skaji/src/github.com/hpcloud/tail/tail.go:418 +0x23a
github.com/hpcloud/tail.(*Tail).tailFileSync(0xc82007a000)
    /Users/skaji/src/github.com/hpcloud/tail/tail.go:272 +0x686
created by github.com/hpcloud/tail.TailFile
    /Users/skaji/src/github.com/hpcloud/tail/tail.go:133 +0x421
exit status 2
lukedirtwalker added a commit to lukedirtwalker/tail that referenced this issue Sep 19, 2019
At the same time also fix some lint issues (deadcode and comments).

Fixes hpcloud/tail#93
nxadm pushed a commit to nxadm/tail that referenced this issue Sep 23, 2019
At the same time also fix some lint issues (deadcode and comments).

Fixes hpcloud/tail#93
@skaji skaji closed this as completed Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant