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 connection. RedisWriteHandler will stall if either one of these outgoing requests hangs. While timeouts will not fix your problem, they will allow you to further diagnose the problem. - Aaron 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.