1

I use StaticHandler in vertx-web to serve all static resource(css js mp4 files),

rootRouter.get("/static/*").handler(StaticHandler.create());

I use <video> tag to access the mp4 file in my page:

<video muted="muted" autoplay="autoplay" loop="loop" src="/static/img/factory.mp4"></video>

When I access the page which contained the mp4 file from Chrome, the server side will report a exception:

03:04:17.893 [vert.x-eventloop-thread-3] ERROR i.vertx.core.net.impl.ConnectionBase - Connection reset by peer
java.io.IOException: Connection reset by peer
    at java.base/sun.nio.ch.FileChannelImpl.transferTo0(Native Method)
    at java.base/sun.nio.ch.FileChannelImpl.transferToDirectlyInternal(FileChannelImpl.java:501)
    at java.base/sun.nio.ch.FileChannelImpl.transferToDirectly(FileChannelImpl.java:566)
    at java.base/sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:678)
    at io.netty.channel.DefaultFileRegion.transferTo(DefaultFileRegion.java:130)
    at io.netty.channel.socket.nio.NioSocketChannel.doWriteFileRegion(NioSocketChannel.java:362)
    at io.netty.channel.nio.AbstractNioByteChannel.doWriteInternal(AbstractNioByteChannel.java:238)
    at io.netty.channel.nio.AbstractNioByteChannel.doWrite0(AbstractNioByteChannel.java:212)
    at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.java:400)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:934)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.forceFlush(AbstractNioChannel.java:361)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:708)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:829)

But when I use Firefox, there will be no problem. And other static resources work normal, only the mp4 file will cause this exception.

Does anyone know what's going on? What should I do?

wangyongjun
  • 145
  • 1
  • 1
  • 9
  • 1
    The connection was reset (RST packet) by Chrome and the JDK does not provide a way to distinguish such an issue from any other IO issue. If you use Wireshark, you should see this happen. – tsegismont Oct 27 '21 at 09:05
  • Why Chrome reset the connection? – wangyongjun Nov 02 '21 at 06:04

1 Answers1

0
Connection reset by peer

is a response by the remote server (or firewall between them) stating that it will not proceed with completing this request.

So the other side has abruptly aborted the connection in midst of a transaction.

There are many possible reasons for this. It may well be a firewall denial, an SSL handshake failure, a VPN issue, slow internet, a proxy problem or even an HTTP failed request.

PS: this and this were helpful.

Updating the vert.x version in use could also print less of such messages as stated here.