Skip to content

Remove lock on stdout #16641

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

Closed

Conversation

SilasMarvin
Copy link

I've been using the lsp-server crate to develop a language server. In my crate I've been using bindgen to link with the llama.cpp and was getting undefined behavior on functions called from llama.cpp when first calling Connection::stdio(). For reasons I don't understand, the lock on stdout seems to be causing llama.cpp functions to freeze with no returned errors. My code is public and available here, but I can highlight or expand on specifics if that is helpful.

Removing the lock on stdout does fix the problem. I'm not sure if this is the right way to solve it, but was hoping to understand a little bit more why we are locking stdout.

Thank you! I love and really appreciate the work you all put into the Rust ecosystem.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 23, 2024
@Veykril
Copy link
Member

Veykril commented Feb 23, 2024

That sounds very odd, and certainly like a problem with llama.cpp. Us taking the lock there is intentional as no one else should be writing to stdout at that point anyways as this would interfere with the protocol.

@lnicola
Copy link
Member

lnicola commented Feb 23, 2024

A backtrace for each thread would be useful here.

@SilasMarvin
Copy link
Author

Thanks for the quick responses. I'll update with some more data when I get some more time to dig into it

@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 26, 2024
@bors
Copy link
Contributor

bors commented Mar 2, 2024

☔ The latest upstream changes (presumably #16704) made this pull request unmergeable. Please resolve the merge conflicts.

@Veykril
Copy link
Member

Veykril commented Mar 11, 2024

I'll close this for now as I don't think that the issue lies on our side with this. Do come back to us if your testing says otherwise though!

@Veykril Veykril closed this Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants