好。这是我的情况,服务器每次启动后,第一个http请求总是失败,第二个,第三个...没问题。
根据来自服务器的日志,您可以看到http请求是一个登录请求,并且服务器已打印令牌,这表示登录请求已成功,但在以下过程中失败了:向客户写令牌。
有人有什么主意吗?预先感谢。
这是服务器的第一个http请求日志:
2019-05-31 15:53:52.415 DEBUG [ XNIO-1 I/O-78] i.u.request : Using ALPN provider JDK9AlpnProvider for connector at /127.0.0.1:9443
2019-05-31 15:53:52.558 DEBUG [ XNIO-1 I/O-78] .s.w.s.a.HttpWebHandlerAdapter : [2741923f] HTTP POST "/asr/up?id=6bdaee96-e9b3-42e9-bb8f-1fe589cfa869"
2019-05-31 15:53:52.573 DEBUG [ XNIO-1 I/O-78] a.RequestMappingHandlerMapping : [2741923f] Mapped to public reactor.core.publisher.Mono<org.springframework.core.io.buffer.DataBuffer> com.onecloud.asrapi.handler.ASRHandler.handleASRUp(java.lang.String,java.lang.String,java.util.List<java.lang.String>,java.util.List<java.lang.String>,java.util.List<java.lang.String>,java.util.List<java.lang.String>,org.springframework.http.server.reactive.ServerHttpRequest,org.springframework.http.server.reactive.ServerHttpResponse)
2019-05-31 15:53:52.636 DEBUG [ XNIO-1 I/O-78] .m.a.ResponseBodyResultHandler : Using 'text/event-stream' given [*/*] and supported [*/*, text/event-stream]
2019-05-31 15:53:52.636 DEBUG [ XNIO-1 I/O-78] .m.a.ResponseBodyResultHandler : [2741923f] 0..1 [org.springframework.core.io.buffer.DataBuffer]
2019-05-31 15:53:52.666 INFO [ XNIO-1 I/O-78] c.o.a.s.ASRService : Param: resolve first package, id: 6bdaee96-e9b3-42e9-bb8f-1fe589cfa869, time: 1559289232666
2019-05-31 15:53:52.667 INFO [ XNIO-1 I/O-78] c.o.a.s.ASRService : Param: ext param:
2019-05-31 15:53:52.703 INFO [ XNIO-1 I/O-78] c.o.a.s.ASRService : Param: service type: LOGIN, appKey: avb41e68dd46419b962d34b272343872
2019-05-31 15:53:52.704 INFO [pool-2-thread-1] c.o.a.s.ASRService : --login--id: 6bdaee96-e9b3-42e9-bb8f-1fe589cfa869
2019-05-31 15:53:52.706 INFO [ XNIO-1 I/O-78] c.o.a.s.ASRService : Param: resolve last package, id: 6bdaee96-e9b3-42e9-bb8f-1fe589cfa869, time: 1559289232706
2019-05-31 15:53:52.755 INFO [pool-2-thread-1] c.o.a.s.HTTUService : HTTP NLU login, token: 18246506dec30f29ea347dc766016b2b57b4a341
2019-05-31 15:53:52.756 DEBUG [pool-2-thread-1] o.s.c.c.DataBufferEncoder : [2741923f] Writing 178 bytes
2019-05-31 15:53:52.773 ERROR [ XNIO-1 I/O-78] i.undertow : UT005032: Listener not making progress on framed channel, closing channel to prevent infinite loop
2019-05-31 15:53:52.774 DEBUG [ XNIO-1 I/O-78] i.u.r.io : Sending rststream on channel Http2Channel peer /127.0.0.1:64416 local /127.0.0.1:9443[ No Receiver [] -- [] -- []] stream 3
java.nio.channels.ClosedChannelException
at io.undertow.protocols.http2.Http2Channel.sendRstStream(Http2Channel.java:1057)
at io.undertow.protocols.http2.Http2StreamSinkChannel.channelForciblyClosed(Http2StreamSinkChannel.java:80)
at io.undertow.protocols.http2.Http2DataStreamSinkChannel.channelForciblyClosed(Http2DataStreamSinkChannel.java:322)
at io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel.close(AbstractFramedStreamSinkChannel.java:539)
at org.xnio.IoUtils.safeClose(IoUtils.java:134)
at io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel$1.run(AbstractFramedStreamSinkChannel.java:211)
at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:582)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:466)
2019-05-31 15:53:52.777 DEBUG [pool-2-thread-1] .s.w.s.a.HttpWebHandlerAdapter : [2741923f] Completed 200 OK
2019-05-31 15:53:52.782 DEBUG [ XNIO-1 I/O-78] i.u.r.io : Marking writes broken on channel Http2Channel peer /127.0.0.1:64416 local 0.0.0.0/0.0.0.0:9443[ No Receiver [] -- [] -- []]
java.nio.channels.ClosedChannelException
at io.undertow.server.protocol.framed.AbstractFramedChannel.markWritesBroken(AbstractFramedChannel.java:876)
at io.undertow.server.protocol.framed.AbstractFramedChannel.flushSenders(AbstractFramedChannel.java:672)
at io.undertow.server.protocol.framed.AbstractFramedChannel.flush(AbstractFramedChannel.java:719)
at io.undertow.server.protocol.framed.AbstractFramedChannel.queueFrame(AbstractFramedChannel.java:712)
at io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel.queueFinalFrame(AbstractFramedStreamSinkChannel.java:257)
at io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel.shutdownWrites(AbstractFramedStreamSinkChannel.java:240)
at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:822)
at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:809)
at io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:508)
at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:342)
at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:68)
at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:457)
at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:118)
at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:67)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:948)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:929)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1175)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:561)
2019-05-31 15:53:52.782 DEBUG [ XNIO-1 I/O-78] i.u.request : Closing HTTP2 channel to /127.0.0.1:64416 due to broken write side
java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method)
at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:113)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:58)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:50)
at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:466)
at org.xnio.nio.NioSocketConduit.write(NioSocketConduit.java:164)
at io.undertow.protocols.ssl.SslConduit.doWrap(SslConduit.java:917)
at io.undertow.protocols.ssl.SslConduit.flush(SslConduit.java:522)
at io.undertow.conduits.IdleTimeoutConduit.flush(IdleTimeoutConduit.java:399)
at org.xnio.conduits.ConduitStreamSinkChannel.flush(ConduitStreamSinkChannel.java:162)
at io.undertow.server.protocol.framed.AbstractFramedChannel.flushSenders(AbstractFramedChannel.java:664)
at io.undertow.server.protocol.framed.AbstractFramedChannel.flush(AbstractFramedChannel.java:719)
at io.undertow.server.protocol.framed.AbstractFramedChannel.queueFrame(AbstractFramedChannel.java:712)
at io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel.queueFinalFrame(AbstractFramedStreamSinkChannel.java:257)
at io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel.shutdownWrites(AbstractFramedStreamSinkChannel.java:240)
at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:822)
at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:809)
at io.undertow.protocols.http2.Http2Channel.createChannelImpl(Http2Channel.java:508)
at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:342)
at io.undertow.protocols.http2.Http2Channel.createChannel(Http2Channel.java:68)
at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:457)
at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:118)
at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:67)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:948)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:929)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1175)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:561)
这是客户的日志:
2019-05-31 15:53:52.234 INFO [ main] c.o.a.ASRClient : Started ASRClient in 2.219 seconds (JVM running for 3.876)
2019-05-31 15:53:52.297 WARN [ main] c.o.a.s.NLUService : access gateway http protocol: http/1.1
2019-05-31 15:53:52.780 ERROR [ main] c.o.a.s.NLUService : NLU Login request falied, error msg:
okhttp3.internal.http2.ConnectionShutdownException
at okhttp3.internal.http2.Http2Connection.newStream(Http2Connection.java:243)
at okhttp3.internal.http2.Http2Connection.newStream(Http2Connection.java:226)
at okhttp3.internal.http2.Http2ExchangeCodec.writeRequestHeaders(Http2ExchangeCodec.java:116)
at okhttp3.internal.connection.Exchange.writeRequestHeaders(Exchange.java:72)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:43)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:43)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
at okhttp3.RealCall.execute(RealCall.java:81)
at com.onecloud.asrapi.service.NLUService.loginByPB(NLUService.java:187)
at com.onecloud.asrapi.service.NLUService.login(NLUService.java:172)
at com.onecloud.asrapi.ASRClient.run(ASRClient.java:69)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:813)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:797)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:324)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.onecloud.asrapi.ASRClient.main(ASRClient.java:56)
2019-05-31 15:53:52.784 INFO [ main] c.o.a.ASRClient : Count: 0, Token: null, Time: 535