Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EOF reached whilst reading during streaming #177

Open
mikehearn opened this issue Apr 28, 2023 · 5 comments
Open

EOF reached whilst reading during streaming #177

mikehearn opened this issue Apr 28, 2023 · 5 comments

Comments

@mikehearn
Copy link

Description

Using the chatCompletions API I observed the following exception:

com.aallam.openai.api.exception.OpenAIHttpException: chunked transfer encoding, state: READING_LENGTH
    at com.aallam.openai.client.internal.http.HttpTransport.handleException(HttpTransport.kt:46)
    at com.aallam.openai.client.internal.http.HttpTransport.perform(HttpTransport.kt:36)
    at com.aallam.openai.client.internal.http.HttpTransport$perform$2.invokeSuspend(HttpTransport.kt)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    at hydraulic.rendai.OpenAI.next(OpenAI.kt:60)
    at hydraulic.rendai.RendaiEngine.fixFiles(RendaiEngine.kt:29)
    at hydraulic.rendai.Rendai.go(Rendai.kt:69)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at picocli.CommandLine.executeUserObject(CommandLine.java:2056)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2451)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2443)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2405)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2263)
    at picocli.CommandLine$RunLast.execute(CommandLine.java:2407)
    at hydraulic.app.impl.AppFrameworkInstance.execute(AppFrameworkInstance.kt:111)
    at picocli.CommandLine.execute(CommandLine.java:2160)
    at hydraulic.app.impl.AppFrameworkRuntime.init(AppFrameworkRuntime.kt:60)
    at hydraulic.rendai.RendaiApplication.main(RendaiApplication.java:50)
  Caused by: java.io.IOException: chunked transfer encoding, state: READING_LENGTH
    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:833)
  Caused by: java.io.EOFException: EOF reached while reading
    ... 3 more

I guess it's possible the other side just hung up, but I figure I'd put it here in case there's some deeper problem being revealed.

@aallam
Copy link
Owner

aallam commented Apr 28, 2023

Hi @mikehearn, yes it most likely that the connection dropped, could you share which HTTP client did you use ? thanks!

@mikehearn
Copy link
Author

mikehearn commented Apr 28, 2023 via email

@zoltish
Copy link

zoltish commented Oct 18, 2023

Did you ever find out what was causing this? Im currently looking into an EOF exception similar to this (although not using streaming); using CIO (also tested with java engine).

@mikehearn
Copy link
Author

It didn't seem to reoccur.

@zoltish
Copy link

zoltish commented Nov 5, 2023

Maybe this can help someone else in the future save hours/days of debugging. My issue was related to using a different ktor version than what the library is using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants