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

Atom freezing when editing ERB files with tree-sitter #18342

Closed
Ben3eeE opened this Issue Oct 26, 2018 · 12 comments

Comments

Projects
None yet
4 participants
@Ben3eeE
Member

Ben3eeE commented Oct 26, 2018

Prerequisites

Description

#18327 (comment) wrote:

I've experienced issues with syntax highlighting in ERB files since updating to 1.32.0. I don't think I can reproduce intentionally, but it did occur to me several times today where syntax highlighting will break during edits and eventually Atom will freeze with high CPU usage for about 10 seconds at a time. It doesn't seem to resolve itself unless I close the file and reopen it.

Steps to Reproduce

Expected behavior: Not freezing/incorrect highlighting

Actual behavior: Atom freezing/incorrect highlighting

Reproduces how often: Unknown

Versions

1.32.0

Additional Information

/cc: @pjrebsch

@Ben3eeE Ben3eeE added the tree-sitter label Oct 26, 2018

@Ben3eeE

This comment has been minimized.

Member

Ben3eeE commented Oct 26, 2018

@maxbrunsfeld @pjrebsch Can you provide some details about how you reproduced this issue to see if we can get some reliable repro steps? 🙇

@pjrebsch

This comment has been minimized.

pjrebsch commented Oct 28, 2018

Since adding useTreeSitterParsers: false, it hasn't happened to me again. I'll re-enable the feature to see how it might be reproducible.

@turgs

This comment has been minimized.

turgs commented Oct 29, 2018

I have the same problem. I'm using Ubuntu 18.10 and the Atom package from atom.io. Atom freezes then crashes. Today alone it's happened over 4 times. As it freezes, I always have an ERB file open and I can see the syntax highlighting is messed up similar to #18327. I'm going to try set useTreeSitterParsers: false in the interim. At the moment I can't get Atom to re-open because it's now trying to open the same windows and crashes again before I can move the cursor or click anything.

@pjrebsch

This comment has been minimized.

pjrebsch commented Oct 31, 2018

@Ben3eeE I've been using Atom in safe mode, but haven't got to editing ERB files until now. Pretty much the first file that I started editing triggered the issue. I was copying and pasting about 80 lines of code into the file and the syntax highlighting immediately broke and Atom froze soon after. It did resolve itself about a minute later, probably because I stopped trying to make edits this time. So we can check off the item about reproducing in safe mode.

screen shot 2018-10-30 at 8 44 40 pm

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Oct 31, 2018

@pjrebsch Thanks for the update. This is a high priority for me but I was not able to reproduce and fix it by tonight's patch release. I hope to get this fixed ASAP and release another hotfix, Atom 1.32.2.

@ghost

This comment has been minimized.

ghost commented Oct 31, 2018

At the moment I can't get Atom to re-open because it's now trying to open the same windows and crashes again before I can move the cursor or click anything.

@turgs -
Hi Tim. Are you still having problems to open Atom? Try opening Atom from the terminal using the command: atom --clear-window-state Does it help you?

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Nov 3, 2018

Ok, I think I've identified the cause of this. I should be able to fix it early next week and then publish another patch release.

maxbrunsfeld added a commit that referenced this issue Nov 5, 2018

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Nov 5, 2018

Ok, I think this is fixed, but I'm not going to close it until someone else confirms. @Ben3eeE can you test this again on master when you get in tomorrow?

I believe the issue was caused by a bug in Tree-sitter itself, which prevented tree rebalancing from working properly in the case of ERB/EJS files. This was exacerbated by some inefficient code in SyntaxNode.children method in node-tree-sitter. I've fixed both issues.

maxbrunsfeld added a commit that referenced this issue Nov 6, 2018

maxbrunsfeld added a commit that referenced this issue Nov 6, 2018

@Ben3eeE

This comment has been minimized.

Member

Ben3eeE commented Nov 6, 2018

@maxbrunsfeld I can no longer reproduce the freezing that I saw earlier when running on 116fd66

I do still see broken highlighting when pasting ERB rapidly. When pasting about 70 lines of ERB I see syntax highlighting flash broken for a short while and then repair itself. If I hold down ctrl-v it breaks after just a couple of hundred lines pasted.

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Nov 8, 2018

Reopening because the fix above doesn't seem to fully address the problem.

maxbrunsfeld added a commit to tree-sitter/tree-sitter that referenced this issue Nov 8, 2018

maxbrunsfeld added a commit to tree-sitter/tree-sitter that referenced this issue Nov 8, 2018

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Nov 8, 2018

@turgs @pjrebsch Sorry for how long this took to fix. We're publishing a new patch release today that contains the fixes. Atom 1.32.2, and Atom 1.33.0-beta2 if you're on beta.

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Nov 9, 2018

Atom 1.32.2 is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment