Actually all if the channels need to be unbuffered. Otherwise you have pending data that isn’t read when the channel is closed. When I make them all unbuffered it works. 

On Mar 4, 2025, at 8:04 AM, cpu...@gmail.com <cpui...@gmail.com> wrote:

Thanks Robert,

did a quick try and still panics. This seems to make sense- the unsubscribe is the root cause of the panic- while it's still in the buffer the channel won't be closed.

Cheers,
Andi

On Tuesday, March 4, 2025 at 3:01:37 PM UTC+1 Robert Engels wrote:
You can’t make the unsubscribe channel buffered. 

On Mar 4, 2025, at 7:55 AM, cpu...@gmail.com <cpu...@gmail.com> wrote:

Thanks Jan, but this just confirms that there is a send on a closed channel. 

It makes me wonder though (far, very far shot): given the map of subscriptions is using the new swissmap, might that be a bug with that? As I've said- very long shot.

Cheers,
Andi

On Tuesday, March 4, 2025 at 2:51:41 PM UTC+1 Jan Mercl wrote:
On Tue, Mar 4, 2025 at 2:41 PM cpu...@gmail.com <cpu...@gmail.com> wrote:

> I've recently run across https://stackoverflow.com/questions/36417199/how-to-broadcast-message-using-channel by icza and tried to use the simple broker in my project.
>
> Unfortunately, it panics with send on closed channel. I couldn't figure out why or where and created a reproducer: https://play.golang.com/p/8hrHf4-nGY2
>
> Can someone spot why this would panic (except for the obvious reason) and how to fix it?

I didn't analyze the code, but maybe this can help:
https://play.golang.com/p/Ix003aXFFul

--
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...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/c1a2ed5f-6b94-4acc-8d8f-465131e74651n%40googlegroups.com.

--
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.
To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/8e554048-40cd-48bb-91f8-d56ade4a32a7n%40googlegroups.com.

--
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.
To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/99D47080-65B7-4D3F-B99D-5790152F96D5%40ix.netcom.com.

Reply via email to