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 wrote:
>
> 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 
> all goroutines waiting for an unpreemptable goroutine to finish. 
>
> Try adding a goroutine that just prints "hello" and sleeps for a second in 
> a loop. If that goroutine stops printing hello then it is very likely to be 
> the problem I described.
>
> On Friday, May 4, 2018 at 7:24:56 AM UTC-7, s...@whites.team wrote:
>>
>> Hi all,
>>
>> I'm having an issue with a messaging server I'm trying to write in Go (my 
>> first real Go project). I'm having an issue that I've not come across 
>> before in Go - the code executes as expected, then hangs after a second or 
>> so indefinitely, no errors, no logs showing it's exited. The code is 
>> available here 
>> <https://gitlab.com/samisagit/go-im-server/blob/changed-redis-handler-buggy/src/main.go#L110>.
>>  
>> The functions of note are RedisWriteHandler and addRedisSender. In func 
>> main I'm seeding a channel with the max amount of items (currently 100k) 
>> then starting RedisWriteHandler, this should auto scale up and down 
>> according to the length of the channel. However before it gets a chance to 
>> scale down it hangs. I've checked with redis-cli and the senders are still 
>> connected, but no more messages are coming though. Unfortunately I can't 
>> replicate this in the go playground as it's never going to return, and it 
>> will take too long and get kicked. I also asked this question here 
>> <https://stackoverflow.com/questions/50129226/golang-channels-getting-stuck> 
>> but it seems to have gone quiet.
>>
>> Based on comments from a couple other questions in this group I've killed 
>> the process manually to get the stack trace which I'll attach, hopefully 
>> this is helpful.
>>
>> Any thoughts would be greatly appreciated!
>>
>> Thanks,
>>
>> Sam
>>
>

-- 
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.

Reply via email to