Grt1228 / chatgpt-steam-output

Open AI ChatGPT流式输出。Open AI Stream output. ChatGPT Stream output.GPT-3.5
460 stars 173 forks source link

运行一段时间后会报Java heap space ,是不是SSE哪里没有关闭; #7

Closed prompt-bot closed 1 year ago

prompt-bot commented 1 year ago

2023-03-15T08:52:50.417+08:00 ERROR 25819 --- [io-10001-exec-1] o.a.coyote.http11.Http11NioProtocol : Failed to complete processing of a request 2594 2595 java.lang.OutOfMemoryError: Java heap space 2596 at java.base/java.nio.HeapByteBuffer.(HeapByteBuffer.java:64) ~[na:na] 2597 at java.base/java.nio.ByteBuffer.allocate(ByteBuffer.java:363) ~[na:na] 2598 at org.apache.coyote.http11.Http11InputBuffer.init(Http11InputBuffer.java:757) ~[tomcat-embed-core-10.1.5.jar!/:na] 2599 at org.apache.coyote.http11.Http11Processor.setSocketWrapper(Http11Processor.java:501) ~[tomcat-embed-core-10.1.5.jar!/:na] 2600 at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:258) ~[tomcat-embed-core-10.1.5.jar!/:na] 2601 at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-10.1.5.jar!/:na] 2602 at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:859) ~[tomcat-embed-core-10.1.5.jar!/:na] 2603 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734) ~[tomcat-embed-core-10.1.5.jar!/:na] 2604 at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.5.jar!/:na] 2605 at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.5.jar!/:na] 2606 at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.5.jar!/:na] 2607 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-10.1.5.jar!/:na] 2608 at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na] 2609 2610 2023-03-15T08:52:50.422+08:00 ERROR 25819 --- [io-10001-exec-1] org.apache.tomcat.util.net.NioEndpoint : Error running socket processor

我已经设置了sse的超时时间为400,如果设置太短由于重连会重复输出,有啥好的建议吗 SseEmitter sseEmitter = new SseEmitter(400*1000l);

Grt1228 commented 1 year ago

更新下最新版

Grt1228 commented 1 year ago

2023-03-15T08:52:50.417+08:00 ERROR 25819 --- [io-10001-exec-1] o.a.coyote.http11.Http11NioProtocol : Failed to complete processing of a request 2594 2595 java.lang.OutOfMemoryError: Java heap space 2596 at java.base/java.nio.HeapByteBuffer.(HeapByteBuffer.java:64) ~[na:na] 2597 at java.base/java.nio.ByteBuffer.allocate(ByteBuffer.java:363) ~[na:na] 2598 at org.apache.coyote.http11.Http11InputBuffer.init(Http11InputBuffer.java:757) ~[tomcat-embed-core-10.1.5.jar!/:na] 2599 at org.apache.coyote.http11.Http11Processor.setSocketWrapper(Http11Processor.java:501) ~[tomcat-embed-core-10.1.5.jar!/:na] 2600 at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:258) ~[tomcat-embed-core-10.1.5.jar!/:na] 2601 at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-10.1.5.jar!/:na] 2602 at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:859) ~[tomcat-embed-core-10.1.5.jar!/:na] 2603 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734) ~[tomcat-embed-core-10.1.5.jar!/:na] 2604 at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.5.jar!/:na] 2605 at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.5.jar!/:na] 2606 at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.5.jar!/:na] 2607 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-10.1.5.jar!/:na] 2608 at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na] 2609 2610 2023-03-15T08:52:50.422+08:00 ERROR 25819 --- [io-10001-exec-1] org.apache.tomcat.util.net.NioEndpoint : Error running socket processor

我已经设置了sse的超时时间为400,如果设置太短由于重连会重复输出,有啥好的建议吗 SseEmitter sseEmitter = new SseEmitter(400*1000l);

建议设置为0,代表永不超时,当数据发送完毕后手动关闭。