记录⼀次Nobufferspaceavailable问题
前⾔:
服务器的接⼝服务⼀直是好的,突然有⼀天,恩,接⼝服务不通了,看log,发现了这个错误:
Caused by: java.SocketException: No buffer space available (maximum connections reached?): connect
at sun.nio.t0(Native Method)
at sun.nio.t(Unknown Source)
at sun.nio.t(Unknown Source)
at sun.nio.t(Unknown Source)
at java.nio.channels.SocketChannel.open(Unknown Source)
at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(Unknown Source)
... 36 common frames omitted
2019-07-0213:10:18 [main] INFO  h.Http11NioProtocol - Pausing ProtocolHandler ["http-nio-8556"]
2019-07-0213:10:18 [main] ERROR Connector - Protocol handler pause failed
java.lang.NullPointerException: null
at at.util.AbstractEndpoint.unlockAccept(AbstractEndpoint.java:899)
at at.util.AbstractEndpoint.pause(AbstractEndpoint.java:1185)
at AbstractProtocol.pause(AbstractProtocol.java:612)
at org.tor.Connector.pause(Connector.java:944)
at org.StandardService.stopInternal(StandardService.java:467)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
at org.StandardServer.stopInternal(StandardServer.java:814)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:377)
at org.springframework.at.TomcatWebServer.stopTomcat(TomcatWebServer.java:247)
at org.springframework.at.TomcatWebServer.stopSilently(TomcatWebServer.java:235)
at org.springframework.at.TomcatWebServer.start(TomcatWebServer.java:210)
at org.springframework.boot.t.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:300)
at org.springframework.boot.t.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162)
at t.fresh(AbstractApplicationContext.java:553)
at org.springframework.boot.fresh(ServletWebServerApplicationContext.java:140)
at org.springframework.fresh(SpringApplication.java:762)
at org.springframework.freshContext(SpringApplication.java:398)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:330)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
at com.winning.platwebservice.DqmsServiceApplication.main(DqmsServiceApplication.java:10)
flect.NativeMethodAccessorImpl.invoke0(Native Method)
springframework和springbootflect.NativeMethodAccessorImpl.invoke(Unknown Source)
flect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at flect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
解决思路:
1.看到No buffer space available,字⾯意思是说缓冲区内存不⾜,于是开始查机器内存:因为我们是window服务器,发现硬盘还有50G,查看运⾏内存还有
10G,虚拟内存还有5G,应该不是这些问题,排除;
2.通过查看time_wait进程发现,pid为8561的有好多time_wait进⾏,再查询发现是zabbix_client,联系了部署zabbix_client的同事,能不能先停⼀下,发现停下后发现tomcat还是⽆法启动,排除;
3.更换端⼝,⽆效;
4.调整部署的xms参数,调⼩调⼤,⽆效;
5.百度,百度告诉我们这个问题要修改注册表信息,要重启,因为服务器部署了很多别⼈的应⽤,没有考虑这种办法;
6.重启tomcat时有报错:
Caused by: java.BindException: Address already in use: connect
at sun.nio.t0(Native Method)
at sun.nio.t(Unknown Source)
at sun.nio.t(Unknown Source)
at sun.nio.t(Unknown Source)
at java.nio.channels.SocketChannel.open(Unknown Source)
at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(Unknown Source)
... 37 common frames omitted
2019-07-02 13:10:46 [main] INFO  h.Http11NioProtocol - Pausing ProtocolHandler ["http-nio-8556"]
2019-07-02 13:10:46 [main] INFO  StandardService - Stopping service [Tomcat]
2019-07-02 13:10:47 [main] INFO  u.LifecycleBase - The stop() method was called on component [StandardServer[-1]] after stop() had already been called. The second call will be ignored. 2019-07-02 13:10:47 [main] INFO  h.Http11NioProtocol - Stopping ProtocolHandler ["http-nio-8556"]
2019-07-02 13:10:47 [main] INFO  h.Http11NioProtocol - Destroying ProtocolHandler ["http-nio-8556"]
2019-07-02 13:10:47 [main] INFO  o.s.b.a.l.ConditionEvaluationReportLoggingListener -
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-07-02 13:10:47 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
The Tomcat connector configured to listen on port 8556 failed to start. The port may already be in use or the connector may be misconfigured.
  猜测可能是因为端⼝被使⽤情况,可是查询端⼝发现这个端⼝没有被使⽤,⽽且更换端⼝也是⽆效,有⼀个印象⽐较深刻的是,我们查询我们⾃⼰端⼝号和其他端⼝号时,总是有⼀个5开头的端⼝被使⽤(⽐如说我们系统是8556端⼝,发现有⼀个58556端⼝被使⽤,查询8561端⼝,也发现有⼀个58561端⼝被使⽤),后来发现有⼀个pid是12122的⼏乎占据了所有5开头的5位数端⼝号,这是⼀个,我们把它杀掉之后,重启tomcat,发现ok了。
总结:
因为这个服务器部署了好多的项⽬,是测试服务器,同⼀时间有很多的连接和http请求,达到了window系统的上限,所以需要修改注册表信息重启,或是停掉消耗资源最多的那个应⽤。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。