Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Producer appeared Channel shutdown: clean channel shutdown; protocol method: #method<channel.close>(reply-code=200, reply-text=Closed due to exception from ConfirmListener.handle{N,A}ck, class-id=0, method-id=0) #849

Closed
johnbukaixin opened this issue Nov 16, 2018 · 11 comments

Comments

@johnbukaixin
Copy link

The environment is spring-amqp:2.0.8,amqp-client:5.4.3. So,does anyone know the possible reason?

@garyrussell
Copy link
Contributor

It means we had some problem processing the acknowledgment; you should see the root cause elsewhere in the log; I just ran a test...

2018-11-16 09:54:44.863 ERROR 58565 --- [ 127.0.0.1:5672] c.r.c.impl.ForgivingExceptionHandler     : ConfirmListener.handle{N,A}ck threw an exception for channel AMQChannel(amqp://[email protected]:5672/,1)

java.lang.RuntimeException: test fail ack
	at org.springframework.amqp.rabbit.connection.PublisherCallbackChannelImpl.handleAck(PublisherCallbackChannelImpl.java:923) ~[spring-rabbit-2.1.2.BUILD-SNAPSHOT.jar:2.1.2.BUILD-SNAPSHOT]
	at com.rabbitmq.client.impl.ChannelN.callConfirmListeners(ChannelN.java:492) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:369) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:670) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:597) [amqp-client-5.4.1.jar:5.4.1]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]

2018-11-16 09:54:54.870 ERROR 58565 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory       : Channel shutdown: clean channel shutdown; protocol method: #method<channel.close>(reply-code=200, reply-text=Closed due to exception from ConfirmListener.handle{N,A}ck, class-id=0, method-id=0)

@johnbukaixin
Copy link
Author

It means we had some problem processing the acknowledgment; you should see the root cause elsewhere in the log; I just ran a test...

2018-11-16 09:54:44.863 ERROR 58565 --- [ 127.0.0.1:5672] c.r.c.impl.ForgivingExceptionHandler     : ConfirmListener.handle{N,A}ck threw an exception for channel AMQChannel(amqp://[email protected]:5672/,1)

java.lang.RuntimeException: test fail ack
	at org.springframework.amqp.rabbit.connection.PublisherCallbackChannelImpl.handleAck(PublisherCallbackChannelImpl.java:923) ~[spring-rabbit-2.1.2.BUILD-SNAPSHOT.jar:2.1.2.BUILD-SNAPSHOT]
	at com.rabbitmq.client.impl.ChannelN.callConfirmListeners(ChannelN.java:492) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:369) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:670) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:597) [amqp-client-5.4.1.jar:5.4.1]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]

2018-11-16 09:54:54.870 ERROR 58565 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory       : Channel shutdown: clean channel shutdown; protocol method: #method<channel.close>(reply-code=200, reply-text=Closed due to exception from ConfirmListener.handle{N,A}ck, class-id=0, method-id=0)

Only this log is output, there is no stack information, and normal business is not affected, only the error log is output.

@garyrussell
Copy link
Contributor

garyrussell commented Nov 16, 2018

It's truncated; can you add the rest? (before and after).

@johnbukaixin
Copy link
Author

johnbukaixin commented Nov 16, 2018

image
image

This is the warning log。

@garyrussell
Copy link
Contributor

This exception is a failure to close the channel after the fact. Please post the whole log (or at least from before the problem to after the last log), so I can get the full picture?

@johnbukaixin
Copy link
Author

johnbukaixin commented Nov 16, 2018

AfterThrowingLogTemplate

StackTrace
org.springframework.amqp.AmqpIOException: java.io.IOException
	at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:71)
	at org.springframework.amqp.rabbit.connection.SimpleConnection.createChannel(SimpleConnection.java:68)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$ChannelCachingConnectionProxy.createBareChannel(CachingConnectionFactory.java:1208)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$ChannelCachingConnectionProxy.access$200(CachingConnectionFactory.java:1196)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.doCreateBareChannel(CachingConnectionFactory.java:599)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createBareChannel(CachingConnectionFactory.java:582)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.getCachedChannelProxy(CachingConnectionFactory.java:552)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.getChannel(CachingConnectionFactory.java:534)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.access$1400(CachingConnectionFactory.java:99)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$ChannelCachingConnectionProxy.createChannel(CachingConnectionFactory.java:1213)
	at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1822)
	at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1790)
	at org.springframework.amqp.rabbit.core.RabbitTemplate.send(RabbitTemplate.java:861)
	at com.mytijian.notify.service.NotifyService.sendMessage(NotifyService.java:35)
	at com.mytijian.notify.service.NotifyService$$FastClassBySpringCGLIB$$22095402.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
	at com.mytijian.origin.components.bizlog.BizLogManager.doAround(BizLogManager.java:66)
			3 lines skipped for [sun., java.lang.reflect.Method]
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
	at com.mytijian.notify.service.NotifyService$$EnhancerBySpringCGLIB$$f863252.sendMessage(<generated>)
	at com.mytijian.gateway.order.service.handler.message.OrderPaySendMessageHandler.gatewaySendMessage(OrderPaySendMessageHandler.java:26)
	at com.mytijian.gateway.order.service.handler.message.OrderPaySendMessageHandler$$FastClassBySpringCGLIB$$a8c225c7.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
	at com.mytijian.origin.components.bizlog.BizLogManager.doAround(BizLogManager.java:66)
			3 lines skipped for [sun., java.lang.reflect.Method]
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
	at com.mytijian.gateway.order.service.handler.message.OrderPaySendMessageHandler$$EnhancerBySpringCGLIB$$a7eb6ac1.gatewaySendMessage(<generated>)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController.pushPaySuccessMessage(UnifyGatewayCallbackController.java:235)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController.doWechatCallback(UnifyGatewayCallbackController.java:206)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController.handleWechatNotifyMsg(UnifyGatewayCallbackController.java:167)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController.callbackWxpay(UnifyGatewayCallbackController.java:76)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController$$FastClassBySpringCGLIB$$fa7f8f56.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
	at com.mytijian.origin.components.bizlog.BizLogManager.doAround(BizLogManager.java:66)
			3 lines skipped for [sun., java.lang.reflect.Method]
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController$$EnhancerBySpringCGLIB$$da2e98ce.callbackWxpay(<generated>)
			4 lines skipped for [sun., java.lang.reflect.Method]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
			1 line skipped for [javax.servlet]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
			6 lines skipped for [javax.servlet, org.apache.catalina, org.apache.tomcat]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
			2 lines skipped for [org.apache.catalina]
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
			2 lines skipped for [org.apache.catalina]
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
			2 lines skipped for [org.apache.catalina]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
			14 lines skipped for [org.apache.catalina, org.apache.tomcat, org.apache.coyote]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
			1 line skipped for [org.apache.tomcat]
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException
	at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:126)
	at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:122)
	at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:144)
	at com.rabbitmq.client.impl.ChannelN.open(ChannelN.java:133)
	at com.rabbitmq.client.impl.ChannelManager.createChannel(ChannelManager.java:176)
	at com.rabbitmq.client.impl.AMQConnection.createChannel(AMQConnection.java:553)
	at org.springframework.amqp.rabbit.connection.SimpleConnection.createChannel(SimpleConnection.java:57)
	... 122 more
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
	at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
	at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
	at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:494)
	at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:288)
	at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:138)
	... 126 more
Caused by: com.rabbitmq.client.ShutdownSignalException: clean channel shutdown; protocol method: #method<channel.close>(reply-code=200, reply-text=OK, class-id=0, method-id=0)
	at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
	at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
	at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:494)
	at com.rabbitmq.client.impl.ChannelN.close(ChannelN.java:616)
	at com.rabbitmq.client.impl.ChannelN.close(ChannelN.java:541)
	at com.rabbitmq.client.impl.StrictExceptionHandler.handleChannelKiller(StrictExceptionHandler.java:72)
	at com.rabbitmq.client.impl.StrictExceptionHandler.handleChannelKiller(StrictExceptionHandler.java:66)
	at com.rabbitmq.client.impl.StrictExceptionHandler.handleConfirmListenerException(StrictExceptionHandler.java:40)
	at com.rabbitmq.client.impl.ChannelN.callConfirmListeners(ChannelN.java:495)
	at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:369)
	at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178)
	at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111)
	at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:670)
	at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48)
	at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:597)
	... 1 more
Caused by: com.rabbitmq.client.ShutdownSignalException: clean channel shutdown; protocol method: #method<channel.close>(reply-code=200, reply-text=OK, class-id=0, method-id=0)
	at com.rabbitmq.client.impl.ChannelN.close(ChannelN.java:588)
	at com.rabbitmq.client.impl.ChannelN.close(ChannelN.java:541)
	at com.rabbitmq.client.impl.ChannelN.close(ChannelN.java:534)
	at org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl.close(PublisherCallbackChannelImpl.java:772)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.getChannel(CachingConnectionFactory.java:500)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.access$1400(CachingConnectionFactory.java:99)
	at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$ChannelCachingConnectionProxy.createChannel(CachingConnectionFactory.java:1213)
	at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1822)
	at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1790)
	at org.springframework.amqp.rabbit.core.RabbitTemplate.send(RabbitTemplate.java:861)
	at com.mytijian.notify.service.NotifyService.sendMessage(NotifyService.java:35)
	at com.mytijian.notify.service.NotifyService$$FastClassBySpringCGLIB$$22095402.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
	at com.mytijian.origin.components.bizlog.BizLogManager.doAround(BizLogManager.java:66)
			3 lines skipped for [sun., java.lang.reflect.Method]
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
	at com.mytijian.notify.service.NotifyService$$EnhancerBySpringCGLIB$$f863252.sendMessage(<generated>)
	at com.mytijian.gateway.order.service.handler.message.OrderPaySendMessageHandler.gatewaySendMessage(OrderPaySendMessageHandler.java:26)
	at com.mytijian.gateway.order.service.handler.message.OrderPaySendMessageHandler$$FastClassBySpringCGLIB$$a8c225c7.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
	at com.mytijian.origin.components.bizlog.BizLogManager.doAround(BizLogManager.java:66)
			3 lines skipped for [sun., java.lang.reflect.Method]
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
	at com.mytijian.gateway.order.service.handler.message.OrderPaySendMessageHandler$$EnhancerBySpringCGLIB$$a7eb6ac1.gatewaySendMessage(<generated>)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController.pushPaySuccessMessage(UnifyGatewayCallbackController.java:235)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController.doWechatCallback(UnifyGatewayCallbackController.java:206)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController.handleWechatNotifyMsg(UnifyGatewayCallbackController.java:167)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController.callbackWxpay(UnifyGatewayCallbackController.java:76)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController$$FastClassBySpringCGLIB$$fa7f8f56.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
	at com.mytijian.origin.components.bizlog.BizLogManager.doAround(BizLogManager.java:66)
			3 lines skipped for [sun., java.lang.reflect.Method]
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
	at com.mytijian.gateway.controller.UnifyGatewayCallbackController$$EnhancerBySpringCGLIB$$da2e98ce.callbackWxpay(<generated>)
			4 lines skipped for [sun., java.lang.reflect.Method]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
			1 line skipped for [javax.servlet]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
			6 lines skipped for [javax.servlet, org.apache.catalina, org.apache.tomcat]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
			2 lines skipped for [org.apache.catalina]
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
			2 lines skipped for [org.apache.catalina]
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
			2 lines skipped for [org.apache.catalina]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
			14 lines skipped for [org.apache.catalina, org.apache.tomcat, org.apache.coyote]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
			1 line skipped for [org.apache.tomcat]

@garyrussell
Copy link
Contributor

Caused by: com.rabbitmq.client.ShutdownSignalException: clean channel shutdown; protocol method: #method<channel.close>(reply-code=200, reply-text=OK, class-id=0, method-id=0)
	at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
	at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
	at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:494)
	at com.rabbitmq.client.impl.ChannelN.close(ChannelN.java:616)
	at com.rabbitmq.client.impl.ChannelN.close(ChannelN.java:541)
	at com.rabbitmq.client.impl.StrictExceptionHandler.handleChannelKiller(StrictExceptionHandler.java:72)
	at com.rabbitmq.client.impl.StrictExceptionHandler.handleChannelKiller(StrictExceptionHandler.java:66)
	at com.rabbitmq.client.impl.StrictExceptionHandler.handleConfirmListenerException(StrictExceptionHandler.java:40)
	at com.rabbitmq.client.impl.ChannelN.callConfirmListeners(ChannelN.java:495)

That is after the fact - it's a failure to close the channel after the ack was failed to be processed.

Again; please provide more of the log; I can't help when you only provide snippets.

@johnbukaixin
Copy link
Author

johnbukaixin commented Nov 16, 2018

@Override
    public void onMessage(Message message, Channel channel) {
        MessageProperties messageProperties = message.getMessageProperties();
        Long deliveryTag = messageProperties.getDeliveryTag();
        String msgId = messageProperties.getMessageId();
        logger.info("消息已到,message body is:{}", new String(message.getBody()));
        RabbitMetaMessage rabbitMetaMessage = null;
        boolean retry = false;
        boolean success = false;
        try {
            rabbitMetaMessage = RabbitMetaMessageUtils.getRabbitMetaMessageWithPayload(message);
            save(rabbitMetaMessage);
            retry = receiveMessage(rabbitMetaMessage);
            if (retry) {
                messageRetry.retry(message, channel);
                return;
            }
            // 成功的回执
            channel.basicAck(deliveryTag, false);
            success = true;
            consumerSuccess(converSuccessObject(rabbitMetaMessage));
            updateConsumerSuccess(rabbitMetaMessage, true);
        } catch (Throwable e) {
            if (success) {
                logger.error("执行consumerSuccess出错 messageId = {}, throwable = {}", msgId, e);
                return;
            }
            logger.error("RabbitMQ 消息消费失败," + e.getMessage(), e);
            updateConsumerSuccess(rabbitMetaMessage, false);
            // 消费失败
            try {
                retry = consumerFaile(converFailObject(rabbitMetaMessage, e));
            } catch (Throwable throwable) {
                logger.error("执行consumerFaile 出错 messageid= {}, throwable = {}", msgId, throwable);
                retry = true;
            }
            // 继续重试
            if (retry) {
                try {
                    messageRetry.retry(message, channel);
                } catch (Throwable throwable) {
                    //rabbit 本身出现异常就让消息阻塞
                    logger.error("重试异常 e= {}", throwable);
                }
            } else {
                // 不需要重试
                try {
                    if (channel.isOpen()) {
                        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
                    }
                } catch (IOException e1) {
                    //rabbit 本身出现异常就让消息阻塞
                    logger.error("消息确认异常 e = {}", e1);
                }
            }

        }
    }

@johnbukaixin
Copy link
Author

The code for the confirmation message is uniform, and other applications do not have this exception

@garyrussell
Copy link
Contributor

You are still not providing me with the information I need to help you. I need to see the stack trace that includes

	at org.springframework.amqp.rabbit.connection.PublisherCallbackChannelImpl.handleAck(PublisherCallbackChannelImpl.java:923) ~[spring-rabbit-2.1.2.BUILD-SNAPSHOT.jar:2.1.2.BUILD-SNAPSHOT]
	at com.rabbitmq.client.impl.ChannelN.callConfirmListeners(ChannelN.java:492) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:369) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:670) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48) [amqp-client-5.4.1.jar:5.4.1]
	at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:597) [amqp-client-5.4.1.jar:5.4.1]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]

which should be somewhere before the trace you are showing me.

One more time; please post the log from before any issues until after the last stack trace.

This error has nothing to do with the onMessage method; it is on the publisher side where some failure to process the publisher confirm occurred.

@garyrussell
Copy link
Contributor

garyrussell commented Nov 16, 2018

I have found one possible condition where this might happen.

@garyrussell garyrussell reopened this Nov 16, 2018
garyrussell added a commit to garyrussell/spring-amqp that referenced this issue Nov 16, 2018
Resolves spring-projects#849

Add defensive catch blocks; we currently catch exceptions in user `handleConfirm`
calls, but not for returns, or for the code that determines which listener to
call.

Throwing exceptions to the client causes the channel to be killed.
artembilan pushed a commit that referenced this issue Nov 19, 2018
Resolves #849

Add defensive catch blocks; we currently catch exceptions in user `handleConfirm`
calls, but not for returns, or for the code that determines which listener to
call.

Throwing exceptions to the client causes the channel to be killed.
artembilan pushed a commit that referenced this issue Nov 19, 2018
Resolves #849

Add defensive catch blocks; we currently catch exceptions in user `handleConfirm`
calls, but not for returns, or for the code that determines which listener to
call.

Throwing exceptions to the client causes the channel to be killed.

# Conflicts:
#	spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/PublisherCallbackChannelImpl.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants