You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When consuming a slowly transmitted stream, such as an LLM response over HTTP, the stream occasionally closes prematurely.
For clarity, is the response from the LLM coming in very slowly to the point the connection just drops. Or does it take a very long time to respond?
This issue likely stems from a change made in pull request #139. Specifically, commenting out the entire elseif block, which includes the condition
elseif (\feof($this->stream)) {
resolves the problem.
Not sure how that would solve this, we only get the updates from the kernel when there is something to act on, and it has to be an active stream. Something that elseif checks for, which was added due to streams getting closed too early while there were still active, but didn't send any data. Also, dropping that block will keep all streams always hooked in the event loop, and in memory. It will create many more issues than it solves.
I believe replacing this block with a timeout mechanism would be a more robust solution.
Activity
WyriHaximus commentedon May 24, 2025
For clarity, is the response from the LLM coming in very slowly to the point the connection just drops. Or does it take a very long time to respond?
Not sure how that would solve this, we only get the updates from the kernel when there is something to act on, and it has to be an active stream. Something that elseif checks for, which was added due to streams getting closed too early while there were still active, but didn't send any data. Also, dropping that block will keep all streams always hooked in the event loop, and in memory. It will create many more issues than it solves.
How long of a timeout are you thinking about?
byfareska commentedon Jun 9, 2025
I think I have found the issue it was my code related, sorry for false alarm!