Top part says: fatal error: concurrent map writes
goroutine 23673 [running]: runtime.throw(0x95fc7f, 0x15) /usr/lib/go/src/runtime/panic.go:566 +0x95 fp=0xc420482708 sp=0xc4204826e8 runtime.mapassign1(0x8cb4c0, 0xc4200e8e10, 0xc420482a88, 0xc420482a68) /usr/lib/go/src/runtime/hashmap.go:553 +0x2e1 fp=0xc4204827f0 sp=0xc420482708 wservce/models.findSupplierOrBuyer(0xc42038812e, 0x6, 0x0, 0x0, 0xc42073e270, 0xf, 0xc420388123, 0x2, 0xba9ac0, 0xc42051c800, ...) /home/nupur/golang/code/src/wservce/models/userDashboard.go:153 +0xc07 fp=0xc420482e80 sp=0xc4204827f0 wservce/models.(*UserDashboard).GetDashboardDetails(0xc4203622a0, 0xba9ac0, 0xc42051c800, 0xc42073e270, 0xf, 0x1, 0x125) /home/nupur/golang/code/src/wservce/models/userDashboard.go:75 +0x14d fp=0xc420483040 sp=0xc420482e80 wservce/controllers.Request.Dashboard(0xba9ac0, 0xc42051c800, 0xc42073e180, 0xf, 0xc4203880f4, 0x40, 0xc4203880f0, 0x3, 0xc42073e270, 0xf, ...) /home/nupur/golang/code/src/wservce/controllers/users.go:172 +0x106c fp=0xc420483410 sp=0xc420483040 wservce/controllers.(*Request).Dashboard(0xc4202b8660, 0x0, 0x0) <autogenerated>:5 +0x6e fp=0xc420483488 sp=0xc420483410 runtime.call32(0xc4204d09c0, 0xc4205aa060, 0xc420588960, 0x800000018) On Tuesday, June 27, 2017 at 10:04:06 AM UTC+5:30, Dave Cheney wrote: > > Your stacktrace is truncated; the crucial part appears at the top of the > output starting with > > panic: > > or > > runtime error: > > On Tuesday, 27 June 2017 14:31:57 UTC+10, Nupur Bansal wrote: >> >> When a load test is run on my service, after about 1000-1500 requests, I >> get this stack trace. I am unable to resolve why it was generated. >> Yes, the output from the service is passed to an output channel and is >> read through that channel. >> >> I am doing something like this: >> package main >> >> import ( >> "fmt" >> //"time" >> ) >> >> func myFunc(done chan string) { >> // Doing something in parallel >> for i := 0; i < 10; i++ { >> fmt.Println(i) >> } >> fmt.Println("Hey! I do useless stuff!") >> done <- "I'm done!" // We send a message on the channel >> } >> >> func main() { >> done1 := make(chan string) >> done2 := make(chan string) >> go myFunc(done1) >> go myFunc2(done2) >> msg := <-done1 >> msg2 := <-done2 >> fmt.Println(msg, msg2) >> >> fmt.Println("Message received, you were indeed useless..") >> } >> >> func myFunc2(done chan string) { >> // Doing something in parallel >> for i := 10; i < 20; i++ { >> fmt.Println(i) >> } >> fmt.Println("Hey! Baby!") >> done <- "I'm again done!" // We send a message on the channel >> } >> >> >> On Thursday, June 22, 2017 at 8:09:33 PM UTC+5:30, Ian Lance Taylor wrote: >>> >>> On Wed, Jun 21, 2017 at 10:49 PM, <nupur....@indiamart.com> wrote: >>> > >>> > I am getting the following error when my services are being load >>> tested. >>> > I am new to goroutines and may be missing something in my >>> implementation. >>> > My service on being hit is running 2 goroutines that call an http >>> request. >>> > After both return , the response from both http requests is returned >>> into a >>> > channel. >>> > What could be the possible reason of the following stack trace of >>> error?? >>> >>> What caused the stack trace? I would have expected to see something >>> at the start saying why it was generated, but I didn't. >>> >>> At first glance it looks like you have a deadlock somewhere. Is there >>> something reading from the channels? >>> >>> Ian >>> >> -- <https://track.indiamart.com/af_ck?offer_id=1&aff_id=1&url_id=2&source=MailBanner> https://www.youtube.com/watch?v=ch-1-DKUQcg -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.