rabbitmq / rabbitmq-server

Open source RabbitMQ: core server and tier 1 (built-in) plugins
https://www.rabbitmq.com/
Other
12.13k stars 3.91k forks source link

STOMP plugin - Error: There is no current subscription with tag #7531

Closed lukebakken closed 1 year ago

lukebakken commented 1 year ago

Discussed in https://github.com/rabbitmq/rabbitmq-server/discussions/3984

Originally posted by **Leifhaa** January 12, 2022 Hello! For the past couple of months I've been experiencing the error: 'There is no current subscription with tag 'T_....' which ocasionally occurs. This week I've tried to get to the bottom of what's causing this and frequently breaking my websocket connections. Going through the logs, I've concluded that the error occurs in RabbitMQ. I'm using Stomp plugin. My current architecture is as following: - Spring boot - RabbitMQ - Client applications, communicating with spring boot through STOMP messages. These are the following logs whenever the issue occurs: RabbitMQ: ``` 2022-01-12 17:47:25.358129+00:00 [dbug] <0.12199.5> Deleting auto-delete queue 'stomp-subscription-vNIRfMHF_j9lJqq6vf7Zbw' in vhost 'dtdeefmb' because its last consumer with tag 'T_15' was cancelled 2022-01-12 17:47:25.391485+00:00 [info] <0.11967.5> closing STOMP connection <0.11967.5> (193.91.129.67:64909 -> 10.56.72.86:61613) 2022-01-12 17:47:25.391747+00:00 [dbug] <0.12212.5> Closing all channels from connection '193.91.129.67:64909 -> 10.56.72.86:61613' because it has been closed ``` Spring boot: ``` 18:47:25.637 [WebSocketClient-AsyncIO-4] INFO com.example.demo.client.ConsumerSessionHandler - Received : There is no current subscription with tag 'T_15'. 18:47:25.639 [WebSocketClient-AsyncIO-4] DEBUG org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator - StandardWebSocketSession[id=84c01a06-2c56-332c-7fa7-e186ba17cbe2, uri=null] closed with CloseStatus[code=1002, reason=null] 18:47:25.639 [WebSocketClient-AsyncIO-4] DEBUG org.springframework.messaging.simp.stomp.DefaultStompSession - Connection closed in session id=eba3d18c-5184-b3dd-3366-03b5d40d2788 18:47:25.639 [WebSocketClient-AsyncIO-4] DEBUG org.springframework.web.socket.adapter.NativeWebSocketSession - Closing StandardWebSocketSession[id=84c01a06-2c56-332c-7fa7-e186ba17cbe2, uri=null] ``` In order to reproduce the problem, I made a tiny project which can replicate this exact error. It also contains the step in order to reproduce the error. It can be found here: https://github.com/Leifhaa/rabbitmq-spring-websocket I suspect there's some kind of multithreading issue as it occurs 'randomly' in my view. I'm not certain about this however. If there's anything more I can contribute with, such as any more logs, assistance in setting up the replication project etc I'd be glad to do so.
mkuratczyk commented 1 year ago

I had the reproduction app running for over an hour and the issue didn't occur. I reduced the sleep time, to make it go through more iterations (it was thousands of subscriptions). I tried main and v3.11.x on OTP25 and OTP26.

It feels like there's something more needed to trigger this problem. If someone can try to adjust rabbitmq-spring-websocket or provide another app we can try, we'll look into this. Otherwise I don't see how we can fix that.

lukebakken commented 1 year ago

Thank you @mkuratczyk