Closed defaultxr closed 5 years ago
Can't reproduce even with the nice reproduction recipe, sorry. Tried with Emacs 25.2 and SBCL 1.3.20.
Is this a source compiled sbcl or one of the stock binaries on https://sourceforge.net/projects/sbcl/files/sbcl/1.3.20/ ?
According to the log, the REPL is indeed busy since the lisp hasn't respoded to the :emacs-channel-send
, but I wonder if its dead. Can you try M-x sly-mrepl-new
, to see if you can open a different repl.
I cannot reproduce this either using Emacs 25.2, latest sly master branch, and SBCL 1.3.20
Thanks for the double check @mfiano
Very strange, now I can't reproduce it either. It was happening consistently before even after restarting Emacs without init files. Sorry for wasting your time, I'll close this issue, and if it happens again I'll try your suggestion. Thanks.
OK, I think I see what the issue is. I was wrong, it doesn't happen when I press q
in the debugger; it happens when I press 2
, which is the [ABORT] abort thread (#<THREAD "sly-channel-3-mrepl-remote-3" RUNNING {1003494B83}>)
restart. I don't think this happens in Slime, but I can definitely avoid doing that in Sly. And using M-x sly-mrepl-new
does allow me to continue in the same session if I do end up using that restart accidentally. This seems like a bug to me so I'm reopening but feel free to close this if it's not.
Hmmm, aborting the thread that is running the REPL is a sure-fire way to block said REPL...
SLIME does have a way to restart the thread if it's killed, so that's why you don't see it. Perhaps SLY could have something similar...
That makes sense to me and in retrospect should've been obvious. So I guess technically NOT a bug, but more just poor expectations on my part due to my Slime habits.
Yes it would. This is a duplicate of an existing issue (don't know which exactly). It's not super important because if you get into the habit of using a to select abort restarts you won't get into this situation. It's also reasonably easy to start a new REPL manually.
Not super important but it is really bad user experience. I can also press `q' and not stumble over this, but the reason alone that I had to figure out what I did "wrong" and report a bug about it (as others did before me) confirms this imho, and I have been a happy slime user for quite a while, and also a sly user for several months, so I'd say I've already got some acquaintance with these tools. It is usually a very bad idea to bite the hand that feeds you, so in 99% of all cases no one would want to kill that thread but rather choose to kill the REPL itself if something bad happens ;-) Among those options available, the consequences of choosing this special option might also not be obvious immediately and one wonders why the REPL suddenly stops working.
So I guess technically NOT a bug, but more just poor expectations on my part due to my Slime habits.
It may not be a bug, but it looks like one.
@hjudt ACK to all that, but this is all subjective. Anyway, It doesn't seem so hard to fix after all. It should at least teardown the REPL more gracefully (I could enhance the message to tell the user to M-x sly-mrepl-new
to start a new one).
I'll see if the auto-restart thing is doable.
It may not be a bug, but it looks like one.
And this is why I marked it "bug".... (and "minor")
So @hjudt I think this is just about fixed, but needs testing (and your opinion). There are now two ways and two commits to fix this:
commit ~76f27dba39c02fb62ae259f69c93552e849d2a7b~fe319482417b189395e53635c22bb6b889498583
Close #122: auto-restart REPL thread if it is killed accidentally
This is the auto-restart behaviour.
commit 8f3359b1a642c518a51a5ade6bbf3212eba71e23 Per #122: handle accidental REPL thread kills more gracefully
This is the more conservative "tell user he messed up" behaviour.
As I predicted, there are some issues with the auto-restart REPL thread. I think I've fixed some (all?) in the latest fe31948 commit...
I have tested the 122 branch with the steps in issue #242 and this works fine. For me, this solution works best, as the user doesn't have to do anything and still gets notified that he would have shot himself in his foot. Perhaps the message could be improved to show the user a better way (like appending "Just use 'q'?" as a suggestion), but that is only a nit-pick.
I don't know... If we're going to restart the thread everytime (and only iff) the user chooses the restart we might as well not have the restart at all
Probably. If the restart is useless after all (is it?), then maybe it would be easier to remove it and let the user handle disconnecting and reconnecting manually when necessary. Honestly, I am not sure why I choose this restart. Returning to the top level might make more sense, but maybe it is just because it usually appears at the bottom of the list and thus can be seen faster.
is it?
The only use I see for it is interrupting a lengthy process in a secondary REPL that you don't plan to use any more. It could be a shortcut to interrupting and tearing down in two separate steps. But that's as pretty thin use case.
Returning to the top level might make more sense,
It certainly does. That's what I use 9 times or of 10.
but maybe it is just because it usually appears at the bottom of the list and thus can be seen faster.
The list is usually 4 or 5 long for me, and I can pick or individual restarts easily. Plus I only use q and a for the last ones.
In summary i think hiding that restart would be best. But I don't think it's easy, as it's established by the implementation's thread library.
I am still convinced the solution as you have presented it in branch 122 is the best one. The user will get notified that something didn't happen as it was supposed to (and maybe recognize it should be done differently) but will still have a working REPL and not wonder why it suddenly got stuck on the next input. Even if that doesn't change the user's behaviour, it should not cause any problems.
Fiddling around with an implementation's own restarts might not be a good idea, to me it seems more prone to breakage and I wonder whether changing that default behaviour would be worth the efforts. Also, this would probably have to be done for every implementation which does sound like a maintenance burden or might even be impossible or at least hard to accomplish.
@hjudt I commited the branch to master. Let's try it for a while, if something goes wrong I will go back to the more conservative commit (the one that tears down gracefully and tells you how to restart a REPL, you lose the history and backreferences)
After the debugger is entered, the Sly REPL appears to become unresponsive to any further attempts to evaluate forms. Using the latest Sly from MELPA, Emacs 25.2.1, SBCL 1.3.20.
emacs -Q -L . -l sly-autoloads --eval '(setq inferior-lisp-program "sbcl")' -f sly
(/ 1 0)
q
(print 'hi)
Then it never returns; pressing any further keys in the REPL just gives a "[sly] REPL is busy" message.
Here is my
*sly-events for sbcl*
buffer after doing the above:If there is any more information I can provide, let me know.