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, <[email protected] <javascript:>>
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.