2016-07-26 66 views
0

我在使用java代碼發佈rabbitMQ中的某些數據時面臨異常。超過最大許可數

在高負載的情況下,當我們試圖發佈太多的併發數據在兔子。

以下跟蹤正在打印。

java.lang.Error: Maximum permit count exceeded 
at java.util.concurrent.Semaphore$Sync.tryReleaseShared(Semaphore.java:192) 
at java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1341) 
at java.util.concurrent.Semaphore.release(Semaphore.java:426) 
at com.rabbitmq.client.impl.WorkPool.increaseUnlimited(WorkPool.java:158) 
at com.rabbitmq.client.impl.WorkPool.access$200(WorkPool.java:70) 
at com.rabbitmq.client.impl.WorkPool$WorkQueue.setUnlimited(WorkPool.java:122) 
at com.rabbitmq.client.impl.WorkPool.unlimit(WorkPool.java:184) 
at com.rabbitmq.client.impl.ConsumerWorkService.unlimit(ConsumerWorkService.java:68) 
at com.rabbitmq.client.impl.ConsumerDispatcher.setUnlimited(ConsumerDispatcher.java:66) 
at com.rabbitmq.client.impl.ChannelN.enqueueRpc(ChannelN.java:1193) 
at com.rabbitmq.client.impl.AMQChannel.quiescingRpc(AMQChannel.java:232) 
at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:224) 
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:209) 
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118) 
at com.rabbitmq.client.impl.ChannelN.queueDeclare(ChannelN.java:833) 
at com.rabbitmq.client.impl.ChannelN.queueDeclare(ChannelN.java:61) 
at ProcessRawReport.feedToRabbit(ProcessRawReport.java:89) 
at ProcessRawReport.doGet(ProcessRawReport.java:78) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) 
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) 
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) 
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) 
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) 
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
at java.lang.Thread.run(Thread.java:745) 

回答

1

我打賭你有RabbitMQ amqp-客戶端的版本3.4.2或接近的東西。從閱讀WorkPool/WorkQueue類的代碼看,他們似乎可以更容易地釋放信號量而不是獲取信號量。所以許可證的數量不斷增加。只要它達到Integer.MAX_VALUE,你就會得到你提供的異常。在空閒系統上可能需要很長時間,但隨着負載的增加,時間會縮短。對於我們的RabbitMQ服務器,它需要大約6周時間才能完成。

看起來像在客戶端的新版本,他們只是完全刪除信號量邏輯,所以我會建議嘗試將客戶端庫升級到3.5.x或3.6.x.

相關問題