labring / FastGPT

FastGPT is a knowledge-based platform built on the LLMs, offers a comprehensive suite of out-of-the-box capabilities such as data processing, RAG retrieval, and visual AI workflow orchestration, letting you easily develop and deploy complex question-answering systems without the need for extensive setup or configuration.
https://tryfastgpt.ai
Other
17.92k stars 4.78k forks source link

通过api接口进行对话,返回 Premature close #955

Closed zhangshuo687686 closed 7 months ago

zhangshuo687686 commented 8 months ago

例行检查

你的版本

问题描述 连续进行知识库问答,发现请求时长超过60秒就会断开,是不是有配置设置fastGPT请求的超时时长

复现步骤

预期结果

相关截图

fastGPT 容器 log如下:

{ message: 'Premature close', stack: 'Error: Premature close\n' + [ERROR] 2024-03-08 09:35:03 sse error: Premature close ' at IncomingMessage. (/app/projects/app/.next/server/chunks/43326.js:9:72087)\n' + ' at Object.onceWrapper (node:events:628:28)\n' + ' at IncomingMessage.emit (node:events:514:28)\n' + ' at emitCloseNT (node:internal/streams/destroy:132:10)\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:81:21)' } [INFO] 2024-03-08 09:35:15 completions running time: 63.616s {}

通过java 调用时报错

sse连接异常data:,异常:{} org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:309) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:272) at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118) at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:297) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141) at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229) at org.springframework.util.StreamUtils.copy(StreamUtils.java:147) 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:227) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.sendInternal(ResponseBodyEmitterReturnValueHandler.java:210) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.send(ResponseBodyEmitterReturnValueHandler.java:203) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.sendInternal(ResponseBodyEmitter.java:189) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:183) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:126) at com.tjfae.space.common.listener.ChatCustomEventSourceListener.handleEvent(ChatCustomEventSourceListener.java:145) at com.tjfae.space.common.listener.ChatCustomEventSourceListener.onEvent(ChatCustomEventSourceListener.java:100) 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.RealCall$AsyncCall.run(RealCall.kt:138) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Caused by: java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcherImpl.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:65) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:470) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:138) at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101) at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:152) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1253) at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:764) at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:717) at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:707) at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:572) 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:1191) at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:399) at org.apache.coyote.Response.action(Response.java:209) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:305) ... 25 common frames omitted Exception in thread "OkHttp Dispatcher" java.lang.IllegalStateException: ResponseBodyEmitter is already set complete at org.springframework.util.Assert.state(Assert.java:76) at org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:182) at org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:126) at com.tjfae.space.common.listener.ChatCustomEventSourceListener.sendFailureDone(ChatCustomEventSourceListener.java:187) at com.tjfae.space.common.listener.ChatCustomEventSourceListener.onFailure(ChatCustomEventSourceListener.java:181) at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:78) at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) at okhttp3.RealCall$AsyncCall.run(RealCall.kt:138) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750)

zhangshuo687686 commented 8 months ago

OkHttpClient 配置的超时时间都超过120秒,怀疑是fastGPT有请求超时时长的限制,能修改吗?

c121914yu commented 8 months ago

OkHttpClient 配置的超时时间都超过120秒,怀疑是fastGPT有请求超时时长的限制,能修改吗?

流式接口 60s 超时(第一次响应就不算超时),非流 6 分钟。

zhangshuo687686 commented 7 months ago

流式接口 60s 超时(第一次响应就不算超时) 这个值能通过修改配置文件把超时时间调大一些吗

c121914yu commented 7 months ago

流式接口 60s 超时(第一次响应就不算超时) 这个值能通过修改配置文件把超时时间调大一些吗

超过 60s 等于不可用没意义。