[go-nuts] Re: Go routines hanging

2018-05-05 Thread sam
I see your point! Line 46 would never be in production, that was just to return for the specific situation I was testing, but the other loop would make more sense using sync. I'll take a look into sync functionality as I've not used it before, but that seems like the idiomatic way to do it!

[go-nuts] Re: Go routines hanging

2018-05-05 Thread James Bardin
On Saturday, May 5, 2018 at 9:30:25 AM UTC-4, s...@whites.team wrote: > > Hi James, > > Thanks for the tip - could you elaborate on your idea of a 'busy loop'? Is > this a loop that is blocked, or just one that is currently operating on > something? I'm not sure what causes GC to act on

[go-nuts] Re: Go routines hanging

2018-05-05 Thread sam
Hi James, Thanks for the tip - could you elaborate on your idea of a 'busy loop'? Is this a loop that is blocked, or just one that is currently operating on something? I'm not sure what causes GC to act on certain go routines. I completely understand that getting the length of the channel

[go-nuts] Re: Go routines hanging

2018-05-05 Thread James Bardin
On Saturday, May 5, 2018 at 6:27:54 AM UTC-4, s...@whites.team wrote: > > debug.SetGCPercent(-1) > stops the issue occurring - so I think we're onto a winner with the > garbage collection idea! Is there something I'm doing wrong that is causing > this GC binning off all of my go routines? >

[go-nuts] Re: Go routines hanging

2018-05-05 Thread sam
debug.SetGCPercent(-1) stops the issue occurring - so I think we're onto a winner with the garbage collection idea! Is there something I'm doing wrong that is causing this GC binning off all of my go routines? Is there a way to avoid this, I'd obviously rather not turn off GC entirely. On

[go-nuts] Re: Go routines hanging

2018-05-05 Thread sam
Thanks for the tip! I tested this out, and all go routines are stopping, I ran a go routine with a non conditional for loop with a print and a sleep of 1 second, and this only ran twice, then nothing! How did you get around this? On Saturday, May 5, 2018 at 12:31:41 AM UTC+1, Michael Andersen

[go-nuts] Re: Go routines hanging

2018-05-05 Thread sam
Please find my code here , the playground won't run the code because of it's dependencies, but the issue may well be to do with these dependencies so I thought I'd better not remove them from the example. On Friday, May 4, 2018 at 5:09:17 PM UTC+1, Aaron

[go-nuts] Re: Go routines hanging

2018-05-04 Thread Michael Andersen
When you say it hangs, do you mean that every single goroutine hangs or just some of them? If it is just some of them, I don't have any ideas, but you could try running with -race to catch deadlocks. If it is all of them then you might be running into a problem that I had where the GC suspends

[go-nuts] Re: Go routines hanging

2018-05-04 Thread Aaron Alpar
Can you distill the code you've provided into something that demonstrates the hangs with the least code possible? Immediately I see a possible problem on lines 131 and 148 or your code: I don't see specification of a timeout for the outgoing connection or sending the message on the outgoing