lmstudio-ai / lmstudio-bug-tracker

Bug tracking for the LM Studio desktop application
2 stars 2 forks source link

Bug in the handling of connections identified, possible source of requests hanging. #23

Open whiskeyfur opened 1 month ago

whiskeyfur commented 1 month ago

Think I found where LM Studio is failing to render a response in some front ends.

HTTP 1.1 mandates a connection header, and that header can be either "keep-alive" or "close"

Case in point, when using sillytavern with LMStudio on the back end, sometimes the connection will appear to hang because the connection isn't being closed on the server side after sending the text completion, when SillyTavern had specified "Connection: Close" as the header.

This might be the cause behind a number of other issues on this board too.

You can try this for yourself with using https://github.com/oobabooga/text-generation-webui.git to compare it to and using wireshark to capture the traffic. Set both to use the same API port, same settings, and then try both one after the other from silly tavern to see when ST hangs.

It'll be because LM Studio isn't respecting the connection header. This is a problem with how LM Studio handles HTTP traffic at the protocol level concerning when to terminate the TCP connection.