Skip to content
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

pylsp-snap 28.2 interaction problem #44

Closed
mazerj opened this issue Sep 20, 2022 · 13 comments
Closed

pylsp-snap 28.2 interaction problem #44

mazerj opened this issue Sep 20, 2022 · 13 comments

Comments

@mazerj
Copy link

mazerj commented Sep 20, 2022

I'm still trying to track this down, but yesterday I updated the snap from 28.1 to 28.2 (linux mint cinnamon 20.2) and suddenly having problems where the pylsp server used by python mode locks up the emacs session. It's something very specific related to triple-quote comment blocks occurring inside a function or class..

Sorry for vague issue, but I'm still trying to find minimal example (will add here when I do), but reverting to 28.1 problem went away, so I'm pretty sure it's about something that changed between emacs snap 28.1->28.2 and not related to pylsp, which hasn't been touched on my machine (v1.4.1, installed from pip).

Wanted to get this out there, because it's a hard lock -- have to kill the process from a shell, so potentially can loose files/data with this one..

Will follow up with more details.

jamie

@alexmurray
Copy link
Owner

Thanks for reporting this issue. Can you try deleting/moving aside any old bytecode (.elc) files and see if this helps?

@alexmurray
Copy link
Owner

@mazerj did you have a chance to try my suggestion above? is this still an issue for you?

@mazerj
Copy link
Author

mazerj commented Oct 13, 2022

Sorry, I got side tracked and needed to finish some stuff, so I just downgraded back to 28.1. I can give it a try over the weekend, if that's useful. Am I still the only one seeing this?

@alexmurray
Copy link
Owner

I haven't received any similar reports so I think you may be the only one. Let me know what you find.

@mazerj
Copy link
Author

mazerj commented Dec 12, 2022

Hi Alex,
I finally got around to tracking down a minimal test file that generates the lockup. When I open this file with the 28.2 build (2022-12-08) it hard locks up my emacs session. It has something to do with lsp choking on the various comments -- unterminated ` or """ (say while your writing the comment). Have to kill the process to recover, loosing files..

Here's the example:

def Foo:
    # comment out next line and works ok, incomplete comment -> locks up
    """
    pass
               
class Bar:
    labelmasks: torch.Tensor
    """blah blah blah - single line common ok, >1 line locks up
    """  
         
class Baz:
    def __init__(self):
	"""apostrophe in this quote causes lock up. It's better to..."""
	pass

@mazerj
Copy link
Author

mazerj commented Dec 14, 2022

@alexmurray By the way -- I completely got rid of my entire ~/.emacs.d dir and opened a file containing the fragment above from bash and it freezes immediately. If you save that frag to foo.py and just do emacs foo.py, it should lock up (or does on my mint installation).

@alexmurray
Copy link
Owner

Apologies for radio silence on this issue. Can you confirm if this is still affecting you?

@mazerj
Copy link
Author

mazerj commented May 3, 2023

Yep. Save that fragment to a file and just open it with emacs -q frag.py and it hard locks up my emacs... have to kill -9 it...
Just for the record:

$ snap list
Name    Version    Rev    Tracking       Publisher    Notes
core    16-2.58.3  14946  latest/stable  canonical✓   core
core18  20230320   2721   latest/stable  canonical✓   base
core20  20230308   1852   latest/stable  canonical✓   base
emacs   28.2       1905   latest/stable  alexmurray✪  classic

@alexmurray
Copy link
Owner

FWIW I can reproduce this running the emacs 28.2 deb on Ubuntu 23.04 - so this doesn't seem specific to the snap.

Also I was able to get a backtrace by sending SIGUSR2 to emacs (killall -SIGUSR2 emacs):

Debugger entered--entering a function:
* #f(compiled-function () #<bytecode 0xb89c776646fa45a>)()
  syntax-ppss()
  python-nav-end-of-statement()
  python-nav-end-of-block()
  python-info-statement-ends-block-p()
  python-nav--forward-sexp(-1 nil nil)
  python-nav-forward-sexp(-1 nil nil)
  python-nav-backward-sexp()
  python-info-docstring-p((0 nil 218 34 nil nil 0 nil 225 nil nil))
  python-font-lock-syntactic-face-function((0 nil 218 34 nil nil 0 nil 225 nil nil))
  font-lock-fontify-syntactically-region(11 348 nil)
  font-lock-default-fontify-region(17 348 nil)
  font-lock-fontify-region(17 348)
  #f(compiled-function (fun) #<bytecode 0x19b615a2f4ce00fd>)(font-lock-fontify-region)
  jit-lock--run-functions(17 348)
  jit-lock-fontify-now(17 1517)
  jit-lock-function(17)
  line-move-partial(1 nil)
  line-move(1 nil nil 1)
  next-line(1 1)
  funcall-interactively(next-line 1 1)
  command-execute(next-line)

I can also reproduce it when running the snap from the beta channel which is based on the emacs-29 upstream branch so it seems this is still not known about upstream. As such, it would be worth reporting this upstream (M-x report-emacs-bug).

I will close this issue as it is not specific to the emacs snap.

@mazerj
Copy link
Author

mazerj commented May 8, 2023

I know this is closed, but just wanted to follow up with the emacs bug report info. My report can be found here: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63363

There were two immediate responses - one saying this looks like https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62325, which it definitely does. The chain seems to indicate this should be fixed in emacs29, which seems strange, since if I'm reading your last response right, it still fails for you with 29..

@mazerj
Copy link
Author

mazerj commented May 8, 2023

And just out of curiosity, I pulled down a 28.2 flatpak just now and it does exactly the same thing as the 28.2 snap. So don't know what's different about the guy saying he can't replicate (on his custom debian build).

@mazerj
Copy link
Author

mazerj commented May 9, 2023

@alexmurray Sorry -- I figured out the channels stufff. I just installed stable/beta snap and when I open that test file (emac -Q), it seems to be ok. So perhaps it is fixed upstream? Could you double check that you're still locking up on 29? My beta snap right now is reporting 29.0.90 ... 2023-05-07 build. Just want to let the emacs devs know whether or not they still need to track this down.. thanks.

@alexmurray
Copy link
Owner

Ah you are right - sorry I am not sure how I tested it before but it definitely seems to be working fine now with emacs from the beta channel (29.0.90-emacs-29-7d6855c) - cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants