Skip to content

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

Closed
nxadm/tail
#7
@skaji

Description

@skaji

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions