FAQ
race: limit on 8192 simultaneously alive goroutines is exceeded, dying
exit status 1
[dog@s3 test]$ go run -race t.go


what's mean?



--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • 小菜 at Nov 18, 2014 at 3:46 am
    my code is this: maybe something wrong with " fmt.Println(s)"

    --------------------------------------------------------------------------------------------------------------------

    package main

    import (
    "fmt"
    "runtime"
    "strconv"
    "strings"
    "sync"
    "time"
    )

    var wg sync.WaitGroup

    type hub struct {
    connections map[string]*connection
    broadcast chan string
    }

    type connection struct {
    t int64
    send chan string
    index string
    }

    var h = hub{
    broadcast: make(chan string, 1),
    connections: make(map[string]*connection),
    }

    func run() {
    //defer wg.Done()

    fmt.Println("run")

    for {
    select {

    case m, ok := <-h.broadcast:
    if !ok {
    fmt.Println(ok)
    } else {
    s := strings.Split(m, "|")
    //i := s[1]
    //c := h.connections[i]
    //c.send <- s[0]

    fmt.Println(s)
    wg.Done()
    }
    default:
    }

    }
    }

    func f1(c *connection) {
    s := c.index
    //fmt.Println("begin:", s)

    m := "hi" + "|" + s

    h.broadcast <- m

    }

    func f(c *connection) {
    f1(c)
    }

    func gettime() int64 {
    return time.Now().UnixNano() / 1000000
    }

    func main() {
    runtime.GOMAXPROCS(runtime.NumCPU())
    t1 := gettime()
    fmt.Println()

    go run()

    for i := 0; i < 100000; i++ {
    s := strconv.Itoa(i)
    t := time.Now().Unix()
    c := connection{t, make(chan string, 256), s}
    wg.Add(1)
    go f(&c)
    }

    wg.Wait()
    t2 := gettime()
    fmt.Println(t2 - t1)
    }







    在 2014年11月18日星期二UTC+8上午11时33分55秒,小菜写道:
    race: limit on 8192 simultaneously alive goroutines is exceeded, dying
    exit status 1
    [dog@s3 test]$ go run -race t.go


    what's mean?


    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Jesse McNelis at Nov 18, 2014 at 5:24 am

    On Tue, Nov 18, 2014 at 2:46 PM, 小菜 wrote:
    my code is this: maybe something wrong with " fmt.Println(s)"
    remove the "default:" from the select{} block.
    It's making your goroutines busy wait, you'll probably notice them
    taking up a lot of CPU.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • 小菜 at Nov 18, 2014 at 5:07 am
    [dog@s3 test]$ go version
    go version go1.3.1 linux/amd64
    [dog@s3 test]$ go env
    GOARCH="amd64"
    GOBIN="/usr/local/go/bin"
    GOCHAR="6"
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/var/www/go"
    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"


    在 2014年11月18日星期二UTC+8上午11时33分55秒,小菜写道:
    race: limit on 8192 simultaneously alive goroutines is exceeded, dying
    exit status 1
    [dog@s3 test]$ go run -race t.go


    what's mean?


    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • 小菜 at Nov 18, 2014 at 5:59 am
    [hi 23428]
    [hi 23429]
    [hi 23430]
    [hi 23431]
    [hi 23432]
    [hi 23433]
    [hi 23434]
    [hi 23435]
    [hi 23436]
    [hi 23437]
    [hi 23438]
    [hi 23439]
    ...
    [hi 23440]
    [hi 23441]
    [hi 23442]
    [hi 23443]
    [hi 23444]
    [hi 23445]
    [hi 23446]
    [hi 23447]
    [hi 23448]
    [hi 23449]
    [hi 23450]
    [hi 23451]
    [hi 23452]
    [hi 23453]
    [hi 23454]
    [hi 23455]
    [hi 23456]
    [hi 23457]
    [hi 23458]
    race: limit on 8192 simultaneously alive goroutines is exceeded, dying
    exit status 1
    [dog@s3 test]$


    在 2014年11月18日星期二UTC+8上午11时33分55秒,小菜写道:
    race: limit on 8192 simultaneously alive goroutines is exceeded, dying
    exit status 1
    [dog@s3 test]$ go run -race t.go


    what's mean?


    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Dave Cheney at Nov 18, 2014 at 6:22 am
    It means don't have more than 8192 goroutines in your program. Reduce the
    number you are starting in the main loop.
    On Tuesday, 18 November 2014 14:33:55 UTC+11, 小菜 wrote:

    race: limit on 8192 simultaneously alive goroutines is exceeded, dying
    exit status 1
    [dog@s3 test]$ go run -race t.go


    what's mean?


    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Dmitry Vyukov at Nov 18, 2014 at 6:40 am
    Race detector has limit of 8192 simultaneously alive goroutines.
    Reduce number of goroutines in the program if you want to verify it
    with race detector.
    This limit does not apply to normal non-race mode.
    On Tue, Nov 18, 2014 at 6:33 AM, 小菜 wrote:
    race: limit on 8192 simultaneously alive goroutines is exceeded, dying
    exit status 1
    [dog@s3 test]$ go run -race t.go


    what's mean?



    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • 小菜 at Nov 18, 2014 at 6:49 am
    I understand it already!



    在 2014年11月18日星期二UTC+8上午11时33分55秒,小菜写道:
    race: limit on 8192 simultaneously alive goroutines is exceeded, dying
    exit status 1
    [dog@s3 test]$ go run -race t.go


    what's mean?


    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 18, '14 at 3:33a
activeNov 18, '14 at 6:49a
posts8
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase