-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Quitting with a non-empty buffer causes hang on restart #659
Comments
I can't reproduce, but I've never tried on Void+Alacritty. Definitely sounds cache-related; I wonder if there could be a deadlock on the cache file somehow? |
@tconbeer @TLipede I'm having the same issue as well. Only way I can get harlequin to start up again is to clear the cache. Please let me know if there is anything else I can do to help!
|
Thanks, @harrymconner (and sorry). I tried to reproduce on my Windows 11 machine with exactly the same setup, and couldn't, with either one or multiple buffers. Does this happen every time, or does it depend on the content of the buffers? |
@tconbeer No worries at all! As far as I can tell, it doesn't matter what is in the buffer(s). It's happening every time. Some more information if it's helpful: |
That did it! I was able to reproduce by installing
|
I was the one who installed with |
Okay, I think I've narrowed it down a bit. If I install the repo directly (using pip, poetry etc.) everything works as expected. But if I install from a package file (whether building the wheel locally or installing from PyPI) cache behaviour doesn't work. I'd guess at some subtleties with pickle (de-)serialization. Have you considered using a different format to store cache @tconbeer? Was there a reason you chose pickle? I was going to try implementing something super basic in json or something to see if that worked |
Yeah, it's even weirder than that -- it can restore the cache if the cache is only whitespace (including newlines). But if you have a selection or non-whitespace characters, the packaged version can't restore the cache, and just hangs. @TLipede Pickle was just a convenience. Given WHEN this is hanging (and what I wrote above), I suspect we're reading from the cache file fine, and it's hanging when the CodeEditor/TextArea is being initialized with some text. |
I'm not sure why my previous comment was deleted, but I'm experiencing this again today with the version installed from pip as well. Harlequin: 1.25.0 How are y'all clearing the cache? I can't seem to find documentation for that on the repo or the website |
There are multiple ways to go about "clearing the cache". The fastest might be just erasing the pickle files. The catalog cache seems to be working, so you might be able to just leave that file as is. On Windows, you'll find the cached pickles here: On macOS, I think they're stored here: On Linux, I think they're stored here: |
I think this is only an issue with 1.25.0. If anyone could please test installing 1.24.x with pipx or uv, that would be helpful. I am considering yanking the 1.25.0 release because I don't have much time to troubleshoot this for the next 1-2 weeks |
@tconbeer It's still hanging for me on 1.24.0 and 1.24.1 when installed with uv |
@harrymconner ok thanks |
I reproduced it with 1.20 too |
Update: I was able to reproduce reliably by using uv to install my local copy of harlequin: uvx --no-cache --from ./harlequin harlequin Using the dev tools (message logger) isn't really possible inside the uv bundle, so I started debugging with So then I used my normal poetry installation of harlequin to change the buffer and quit, and then running the uvx version I was able to reproduce the hang again. I can confirm that it's not hanging in There's a larger issue with the async/message pump system that is causing the infinite loop, and is probably also causing #668. The regression seems to have come in v1.18: uvx [email protected] # this works
uvx [email protected] # this hangs I'm out of time right now; will try to get to the bottom of this in the next week. In the meantime, the work-around is to downgrade all the way to 1.17.0 |
I can also reliably reproduce this with uv / pipx installed Harlequin on MacOS. The thing I noticed, is it's not deadlocking, it's hanging with 100% CPU. I used
Rich 13.9.2 was released ~2 weeks ago and mentions a fix to "split_cells": https://github.com/Textualize/rich/releases/tag/v13.9.2 - suspiciously around the time these reports started coming in. Downgrading rich to 13.9.1 seems to fix it for me. [edit] I think this is the problem/fix: Textualize/rich#3532 |
Thank you!! I didn't know how to do that and couldn't manage to get a trace. Thanks also for the upstream issues! |
Upstream issue is fixed -- need to bump the textual version to 0.85.0 to bring the fix to Harlequin. |
I have a branch with the upgrade, and can confirm it fixes this issue; unfortunately it introduces a few new ones, and it'll take me some time to iron that out. (Time I don't have today) |
Before Proceeding, please acknowledge:
Describe the bug
If the editor is closed with the quit keybinding with a non-empty buffer, future restarts of
harlequin
hang. I think this is cache related as deleting the harlequin cache directory fixes this.To Reproduce
^q
or otherwise)Expected behavior
Harlequin should run normally on second invocation.
Actual behavior
Harlequin hangs on second invocation.
Contributing
Are you interested in contributing a fix?
Additional context
I can load the cache locally after stopping harlequin using the
load_cache()
method, so the cache isn't corrupted. If I use the methods to clear the editor cache, harlequin also behaves normally.What is the output of
harlequin --version
?What database adapter are you using with Harlequin? (Default is
duckdb
)This occurs with duckdb and postgres.
What other options are you using when invoking Harlequin? (If you are using a profile, please add relevant items from your profile here).
Just postgres connection details & limits for duckdb.
Can you tell us more about your system?
Tip
For example, for my system, these are:
How did you install Harlequin?
The text was updated successfully, but these errors were encountered: