Open Abecedariann opened 5 months ago
方便把完整的错误堆栈放出来吗 @Abecedariann
方便把完整的错误堆栈放出来吗 @Abecedariann
java.io.IOException: 你的主机中的软件中止了一个已建立的连接。 at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method) at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:54) at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:97) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:53) at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:532) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:118) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1381) at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:764) at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:728) at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:712) at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:566) at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:157) at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:220) at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1245) at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:399) at org.apache.coyote.Response.action(Response.java:208) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:301) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:267) at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118) at java.base/sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:320) at java.base/sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:160) at java.base/java.io.OutputStreamWriter.flush(OutputStreamWriter.java:248) at org.springframework.util.StreamUtils.copy(StreamUtils.java:138) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:126) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:44) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:226) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.sendInternal(ResponseBodyEmitterReturnValueHandler.java:211) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.send(ResponseBodyEmitterReturnValueHandler.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.sendInternal(ResponseBodyEmitter.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:198) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:127) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:110) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:91) at com.moyz.adi.common.interfaces.AbstractLLMService.lambda$sseChat$1(AbstractLLMService.java:151) at dev.langchain4j.service.AiServiceStreamingResponseHandler.onNext(AiServiceStreamingResponseHandler.java:53) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.handle(OpenAiStreamingChatModel.java:174) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.lambda$generate$1(OpenAiStreamingChatModel.java:155) at dev.ai4j.openai4j.StreamingRequestExecutor$2.onEvent(StreamingRequestExecutor.java:178) at okhttp3.internal.sse.RealEventSource.onEvent(RealEventSource.kt:101) at okhttp3.internal.sse.ServerSentEventReader.completeEvent(ServerSentEventReader.kt:108) at okhttp3.internal.sse.ServerSentEventReader.processNextEvent(ServerSentEventReader.kt:52) at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:75) at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842)
2024-06-20 09:04:16.518 ERROR [OkHttp https://api.xty.app/...] com.moyz.adi.common.interfaces.AbstractLLMService stream onNext error
org.apache.catalina.connector.ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。 at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:305) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:267) at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118) at java.base/sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:320) at java.base/sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:160) at java.base/java.io.OutputStreamWriter.flush(OutputStreamWriter.java:248) at org.springframework.util.StreamUtils.copy(StreamUtils.java:138) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:126) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:44) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:226) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.sendInternal(ResponseBodyEmitterReturnValueHandler.java:211) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.send(ResponseBodyEmitterReturnValueHandler.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.sendInternal(ResponseBodyEmitter.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:198) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:127) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:110) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:91) at com.moyz.adi.common.interfaces.AbstractLLMService.lambda$sseChat$1(AbstractLLMService.java:151) at dev.langchain4j.service.AiServiceStreamingResponseHandler.onNext(AiServiceStreamingResponseHandler.java:53) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.handle(OpenAiStreamingChatModel.java:174) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.lambda$generate$1(OpenAiStreamingChatModel.java:155) at dev.ai4j.openai4j.StreamingRequestExecutor$2.onEvent(StreamingRequestExecutor.java:178) at okhttp3.internal.sse.RealEventSource.onEvent(RealEventSource.kt:101) at okhttp3.internal.sse.ServerSentEventReader.completeEvent(ServerSentEventReader.kt:108) at okhttp3.internal.sse.ServerSentEventReader.processNextEvent(ServerSentEventReader.kt:52) at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:75) at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) Caused by: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。 at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method) at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:54) at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:97) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:53) at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:532) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:118) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1381) at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:764) at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:728) at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:712) at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:566) at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:157) at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:220) at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1245) at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:399) at org.apache.coyote.Response.action(Response.java:208) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:301) ... 30 common frames omitted
2024-06-20 09:04:16.519 INFO [OkHttp https://api.xty.app/...] com.moyz.adi.common.interfaces.AbstractLLMService get content:您 2024-06-20 09:04:16.519 ERROR [OkHttp https://api.xty.app/...] com.moyz.adi.common.interfaces.AbstractLLMService stream error
java.lang.IllegalStateException: ResponseBodyEmitter has already completed at org.springframework.util.Assert.state(Assert.java:97) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:196) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:127) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:110) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:91) at com.moyz.adi.common.interfaces.AbstractLLMService.lambda$sseChat$1(AbstractLLMService.java:151) at dev.langchain4j.service.AiServiceStreamingResponseHandler.onNext(AiServiceStreamingResponseHandler.java:53) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.handle(OpenAiStreamingChatModel.java:174) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.lambda$generate$1(OpenAiStreamingChatModel.java:155) at dev.ai4j.openai4j.StreamingRequestExecutor$2.onEvent(StreamingRequestExecutor.java:178) at okhttp3.internal.sse.RealEventSource.onEvent(RealEventSource.kt:101) at okhttp3.internal.sse.ServerSentEventReader.completeEvent(ServerSentEventReader.kt:108) at okhttp3.internal.sse.ServerSentEventReader.processNextEvent(ServerSentEventReader.kt:52) at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:75) at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842)
2024-06-20 09:04:16.519 INFO [http-nio-9999-exec-2] com.moyz.adi.common.helper.SSEEmitterHelper response complete,uid:1 2024-06-20 09:04:16.519 ERROR [OkHttp https://api.xty.app/...] dev.langchain4j.service.AiServiceStreamingResponseHandler While handling the following error...
我也遇到了,应该是超时时间设置的问题
我也遇到了,应该是超时时间设置的问题
SseEmitter超时时间吗 我都设置的挺大了
方便把完整的错误堆栈放出来吗 @Abecedariann
java.io.IOException: 你的主机中的软件中止了一个已建立的连接。 at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method) at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:54) at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:97) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:53) at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:532) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:118) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1381) at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:764) at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:728) at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:712) at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:566) at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:157) at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:220) at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1245) at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:399) at org.apache.coyote.Response.action(Response.java:208) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:301) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:267) at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118) at java.base/sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:320) at java.base/sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:160) at java.base/java.io.OutputStreamWriter.flush(OutputStreamWriter.java:248) at org.springframework.util.StreamUtils.copy(StreamUtils.java:138) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:126) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:44) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:226) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.sendInternal(ResponseBodyEmitterReturnValueHandler.java:211) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.send(ResponseBodyEmitterReturnValueHandler.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.sendInternal(ResponseBodyEmitter.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:198) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:127) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:110) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:91) at com.moyz.adi.common.interfaces.AbstractLLMService.lambda$sseChat$1(AbstractLLMService.java:151) at dev.langchain4j.service.AiServiceStreamingResponseHandler.onNext(AiServiceStreamingResponseHandler.java:53) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.handle(OpenAiStreamingChatModel.java:174) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.lambda$generate$1(OpenAiStreamingChatModel.java:155) at dev.ai4j.openai4j.StreamingRequestExecutor$2.onEvent(StreamingRequestExecutor.java:178) at okhttp3.internal.sse.RealEventSource.onEvent(RealEventSource.kt:101) at okhttp3.internal.sse.ServerSentEventReader.completeEvent(ServerSentEventReader.kt:108) at okhttp3.internal.sse.ServerSentEventReader.processNextEvent(ServerSentEventReader.kt:52) at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:75) at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842)
2024-06-20 09:04:16.518 ERROR [OkHttp https://api.xty.app/...] com.moyz.adi.common.interfaces.AbstractLLMService stream onNext error
org.apache.catalina.connector.ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。 at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:305) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:267) at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118) at java.base/sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:320) at java.base/sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:160) at java.base/java.io.OutputStreamWriter.flush(OutputStreamWriter.java:248) at org.springframework.util.StreamUtils.copy(StreamUtils.java:138) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:126) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:44) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:226) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.sendInternal(ResponseBodyEmitterReturnValueHandler.java:211) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.send(ResponseBodyEmitterReturnValueHandler.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.sendInternal(ResponseBodyEmitter.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:198) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:127) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:110) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:91) at com.moyz.adi.common.interfaces.AbstractLLMService.lambda$sseChat$1(AbstractLLMService.java:151) at dev.langchain4j.service.AiServiceStreamingResponseHandler.onNext(AiServiceStreamingResponseHandler.java:53) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.handle(OpenAiStreamingChatModel.java:174) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.lambda$generate$1(OpenAiStreamingChatModel.java:155) at dev.ai4j.openai4j.StreamingRequestExecutor$2.onEvent(StreamingRequestExecutor.java:178) at okhttp3.internal.sse.RealEventSource.onEvent(RealEventSource.kt:101) at okhttp3.internal.sse.ServerSentEventReader.completeEvent(ServerSentEventReader.kt:108) at okhttp3.internal.sse.ServerSentEventReader.processNextEvent(ServerSentEventReader.kt:52) at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:75) at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) Caused by: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。 at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method) at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:54) at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:97) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:53) at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:532) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:118) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1381) at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:764) at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:728) at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:712) at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:566) at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:157) at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:220) at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1245) at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:399) at org.apache.coyote.Response.action(Response.java:208) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:301) ... 30 common frames omitted
2024-06-20 09:04:16.519 INFO [OkHttp https://api.xty.app/...] com.moyz.adi.common.interfaces.AbstractLLMService get content:您 2024-06-20 09:04:16.519 ERROR [OkHttp https://api.xty.app/...] com.moyz.adi.common.interfaces.AbstractLLMService stream error
java.lang.IllegalStateException: ResponseBodyEmitter has already completed at org.springframework.util.Assert.state(Assert.java:97) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:196) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:127) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:110) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:91) at com.moyz.adi.common.interfaces.AbstractLLMService.lambda$sseChat$1(AbstractLLMService.java:151) at dev.langchain4j.service.AiServiceStreamingResponseHandler.onNext(AiServiceStreamingResponseHandler.java:53) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.handle(OpenAiStreamingChatModel.java:174) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.lambda$generate$1(OpenAiStreamingChatModel.java:155) at dev.ai4j.openai4j.StreamingRequestExecutor$2.onEvent(StreamingRequestExecutor.java:178) at okhttp3.internal.sse.RealEventSource.onEvent(RealEventSource.kt:101) at okhttp3.internal.sse.ServerSentEventReader.completeEvent(ServerSentEventReader.kt:108) at okhttp3.internal.sse.ServerSentEventReader.processNextEvent(ServerSentEventReader.kt:52) at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:75) at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842)
2024-06-20 09:04:16.519 INFO [http-nio-9999-exec-2] com.moyz.adi.common.helper.SSEEmitterHelper response complete,uid:1 2024-06-20 09:04:16.519 ERROR [OkHttp https://api.xty.app/...] dev.langchain4j.service.AiServiceStreamingResponseHandler While handling the following error...
@Abecedariann 这个看起来像是AI接口那边主动断开的,根据日志信息,发现你用的是代理的AI接口,建议先确认下代理接口是否支持SSE。 或者换个AI接口试试?比如说千帆的几个模型免费了,可以加上去把功能跑通
方便把完整的错误堆栈放出来吗 @Abecedariann
java.io.IOException: 你的主机中的软件中止了一个已建立的连接。 at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method) at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:54) at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:97) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:53) at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:532) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:118) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1381) at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:764) at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:728) at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:712) at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:566) at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:157) at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:220) at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1245) at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:399) at org.apache.coyote.Response.action(Response.java:208) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:301) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:267) at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118) at java.base/sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:320) at java.base/sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:160) at java.base/java.io.OutputStreamWriter.flush(OutputStreamWriter.java:248) at org.springframework.util.StreamUtils.copy(StreamUtils.java:138) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:126) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:44) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:226) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.sendInternal(ResponseBodyEmitterReturnValueHandler.java:211) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.send(ResponseBodyEmitterReturnValueHandler.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.sendInternal(ResponseBodyEmitter.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:198) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:127) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:110) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:91) at com.moyz.adi.common.interfaces.AbstractLLMService.lambda$sseChat$1(AbstractLLMService.java:151) at dev.langchain4j.service.AiServiceStreamingResponseHandler.onNext(AiServiceStreamingResponseHandler.java:53) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.handle(OpenAiStreamingChatModel.java:174) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.lambda$generate$1(OpenAiStreamingChatModel.java:155) at dev.ai4j.openai4j.StreamingRequestExecutor$2.onEvent(StreamingRequestExecutor.java:178) at okhttp3.internal.sse.RealEventSource.onEvent(RealEventSource.kt:101) at okhttp3.internal.sse.ServerSentEventReader.completeEvent(ServerSentEventReader.kt:108) at okhttp3.internal.sse.ServerSentEventReader.processNextEvent(ServerSentEventReader.kt:52) at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:75) at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) 2024-06-20 09:04:16.518 ERROR [OkHttp https://api.xty.app/...] com.moyz.adi.common.interfaces.AbstractLLMService stream onNext error org.apache.catalina.connector.ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。 at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:305) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:267) at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118) at java.base/sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:320) at java.base/sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:160) at java.base/java.io.OutputStreamWriter.flush(OutputStreamWriter.java:248) at org.springframework.util.StreamUtils.copy(StreamUtils.java:138) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:126) at org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:44) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:226) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.sendInternal(ResponseBodyEmitterReturnValueHandler.java:211) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.send(ResponseBodyEmitterReturnValueHandler.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.sendInternal(ResponseBodyEmitter.java:204) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:198) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:127) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:110) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:91) at com.moyz.adi.common.interfaces.AbstractLLMService.lambda$sseChat$1(AbstractLLMService.java:151) at dev.langchain4j.service.AiServiceStreamingResponseHandler.onNext(AiServiceStreamingResponseHandler.java:53) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.handle(OpenAiStreamingChatModel.java:174) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.lambda$generate$1(OpenAiStreamingChatModel.java:155) at dev.ai4j.openai4j.StreamingRequestExecutor$2.onEvent(StreamingRequestExecutor.java:178) at okhttp3.internal.sse.RealEventSource.onEvent(RealEventSource.kt:101) at okhttp3.internal.sse.ServerSentEventReader.completeEvent(ServerSentEventReader.kt:108) at okhttp3.internal.sse.ServerSentEventReader.processNextEvent(ServerSentEventReader.kt:52) at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:75) at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) Caused by: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。 at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method) at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:54) at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:97) at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:53) at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:532) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:118) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1381) at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:764) at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:728) at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:712) at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:566) at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:157) at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:220) at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1245) at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:399) at org.apache.coyote.Response.action(Response.java:208) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:301) ... 30 common frames omitted 2024-06-20 09:04:16.519 INFO [OkHttp https://api.xty.app/...] com.moyz.adi.common.interfaces.AbstractLLMService get content:您 2024-06-20 09:04:16.519 ERROR [OkHttp https://api.xty.app/...] com.moyz.adi.common.interfaces.AbstractLLMService stream error java.lang.IllegalStateException: ResponseBodyEmitter has already completed at org.springframework.util.Assert.state(Assert.java:97) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:196) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:127) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:110) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:91) at com.moyz.adi.common.interfaces.AbstractLLMService.lambda$sseChat$1(AbstractLLMService.java:151) at dev.langchain4j.service.AiServiceStreamingResponseHandler.onNext(AiServiceStreamingResponseHandler.java:53) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.handle(OpenAiStreamingChatModel.java:174) at dev.langchain4j.model.openai.OpenAiStreamingChatModel.lambda$generate$1(OpenAiStreamingChatModel.java:155) at dev.ai4j.openai4j.StreamingRequestExecutor$2.onEvent(StreamingRequestExecutor.java:178) at okhttp3.internal.sse.RealEventSource.onEvent(RealEventSource.kt:101) at okhttp3.internal.sse.ServerSentEventReader.completeEvent(ServerSentEventReader.kt:108) at okhttp3.internal.sse.ServerSentEventReader.processNextEvent(ServerSentEventReader.kt:52) at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:75) at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:842) 2024-06-20 09:04:16.519 INFO [http-nio-9999-exec-2] com.moyz.adi.common.helper.SSEEmitterHelper response complete,uid:1 2024-06-20 09:04:16.519 ERROR [OkHttp https://api.xty.app/...] dev.langchain4j.service.AiServiceStreamingResponseHandler While handling the following error...
@Abecedariann 这个看起来像是AI接口那边主动断开的,根据日志信息,发现你用的是代理的AI接口,建议先确认下代理接口是否支持SSE。 或者换个AI接口试试?比如说千帆的几个模型免费了,可以加上去把功能跑通
我本地部署的llama模型也是有这个问题
一样的问题,通常出现在长文本生成的情况下
我也遇到了,应该是超时时间设置的问题
请问解决了吗 我也遇到了 在哪里设置超时时间
经常会有这个错误