I have running machine with Spring (Spring Boot 1.5.2.RELEASE)
application. Recently I'm receiving a lot of warnings in my log file:
.w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: null; nested exception is java.net.SocketTimeoutException
I've checked with tcpdump
and a lot of request don't have body (empty/null) or have incorrect body e.g. \00\00\00\00\00\00\00speed":"23.3","user_id":106312}
The biggest problem is that after some time I'm starting to receiving exceptions in my app:
org.apache.tomcat.util.net.NioEndpoint : Socket accept failed
java.io.IOException: Too many open files
at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:241)
at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:443)
at java.lang.Thread.run(Thread.java:745)
ulimit -n
says that limit of open files is set to 65536
so I think it's big enough.
I'm assuming that receiving big amount of invalid requests causes IOException but why? And what should I do to avoid it and fix it?
I guess you use web socket with spring boot. You can listen on only 65535 port maximum, you can't exceed this amount of value on a machine. You should check if you close properly your sockets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With