Skip to content

go 1.5.1 linux/amd64 deadlock detection failed #12734

@wudizhanche1000

Description

@wudizhanche1000
package main

import (
    "log"
    "net/http"
)
//delete this function, it would perform well
func useless_func(address string) []byte {
    http.Get("https://www.google.com")
    return nil
}
func test_a(test_channel chan int) {
    test_channel <- 1
    return
}

func test() {
    test_channel := make(chan int)
    for i := 0; i < 10; i++ {
        go test_a(test_channel)
    }
    for {
        log.Println(<-test_channel)
    }
}
func main() {
    test()
}

this code won't break because of clearly deadlock, it only happened under Linux with go 1.5.1. but if i delete useless_func and run it again, it would raise a deadlock error as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions