-
Notifications
You must be signed in to change notification settings - Fork 452
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
Beautify On Save crashes Atom editor #924
Comments
Does not appear to crash jsbeautifier.org |
Same problem here since atom update 1.7.1. Atom crash and replace my file I was trying to save by a blank zero byte file ... very annoying. I can reproduced this bug on every file, juste by saving several times in a row. |
@victorlambert When this problem occurs is it any kind of language or a particular language that causes the problem? Any kind of evidences as to whether this is a language specific, Atom Beautify specific, or Atom defect would be helpful. |
Seems to be all languages I use, I just tried JSON, JS, HTML and it always crashed when atom beautify had to indent code. I noticed that saving is now a little bit longer, like atom is freezing when I manage to not make it crash. My workaround for now is just to disable "beautify on save" and to save and beautify separately. Since this is very annoying for me, I would provide any information I can, if anyone could tell me where I can find log files. |
So for me it happens only with that one file. If I press cmd+s it crashes. |
I forgot to add that if atom crashes the file does not get saved instead it gets deleted! |
@victorlambert : You can create the debugging log data by following the instructions found at https://github.com/Glavin001/atom-beautify/blob/master/ISSUE_TEMPLATE.md#how-to-create-debugmd-gist I tried @meat147 's code above and am unable to reproduce this problem -- it beautifies properly and saves without crashing. Also, looking at the debugging logs everything appears to be working. I do notice that the first time I save after recently opening Atom it takes a little longer, which I think is because Atom-Beautify and other packages that handle the It would be helpful if someone who can reproduce this issue could open up Developer Tools and step through the code to see where it gets stuck and crashes Atom. Any other information that will help us reproduce would be great, too. Thanks! Hopefully we can solve this soon. |
I uploaded two Videos like i said it happens only if i press cmd+s and I am on Mac https://youtu.be/dAP-ahteu-o And if I beautify with the cmd+shift+p and then beautify works just fine. |
Am having the same problem. This package crashes Atom randomly on save (any type of file, although I'm mostly in .js & .jsx). What is even worse, is that it creates a zero length file deleting everything that you are currently editing in the open file. Fortunately I had Git to save the day. Have disabled this package until a fix can be found. Have tried debugging but cannot find the cause :( |
@joecarney disabling on save should stop this from happening at least it did for me |
@meat147 just tried disabling all beautify on save and it has crashed again :( I have developer tools open, with preserve log enabled, when it crashes the inspected target gets disconnected and when I reload there is nothing in log from beautify. Am happy to help debugging this package but no idea as to the best way of capturing anything at this stage. I very much doubt creating a Gist of my code will help, it crashes in many different files Will leave this package disabled until a fix has been found. |
Unfortunately, I'm in the middle of final exams and writing my thesis this week, so I am not able to allocate much time to debugging this right now. In the meantime, I recommend that each of you experiencing this issue disable the beautify on save temporarily. Note: With this issue I am focusing on the users that are experiencing Atom crashing after beautifying on save. I recognize that the first time you save it takes a moment to load Atom-Beautify. On slower computers, I can imagine this delay becomes more noticeable. I will also be working on the performance with #876, so please subscribe to that issue there. I have just published v0.29.3 release. I recommend that each of you do the following steps listed below. If you follow the steps it will likely be very obvious where things start to go wrong and Atom freezes and consequently crashes.
Given my very limited time this month, this is the best I can do for now. I hope we can figure this out together! Thanks for your patience and feedback. |
I noticed this mostly when using the JSON beautifier. It will consistently crash with 'Beautify On Save' enabled. Additionally, the file is zero'd out and all contents are lost. Disabling 'Beautify On Save' and running the beautify manually works as expected with no crash or zero'd data. Atom 1.7.1 |
@emveeoh : What do you see in the developer console logs when you follow the steps provided in the comment #924 (comment) ? It is critical that we narrow down what lines of code are causing Atom to crash.
I've heard of this happening when users beautify a few multiple times before beautification has completed, such as saving quickly and repeatedly. See #481 (comment) for an old comment that explains some more. Is this what causes it for you? Or it will delete contents even if you only trigger beautification once? |
It deletes contents nearly 100% of the time. I am also now seeing this same behavior with .ejs files (Javascript templates). I tried to change the document type from 'Javascript template' to 'html' at the bottom of the screen. I did a 'save' and Atom crashed and the page contents were lost. Unselected 'Beautify On Save' for every language and I have not had any problems since. I initially assumed it was just the JSON beautifier. Now, I think it's any of them that execute automatically on save. I will follow the steps in comment #924 and report back to you shortly. |
@Glavin001 |
@emveeoh your video is set to privat you need to put it to unlisted. |
@meat147 @Glavin001 Oops! Sorry guys... Video should be public now... Apologies. |
So at https://youtu.be/ces74eQKBFk?t=4m23s Thank you @emveeoh for your video! This helped me understand what it is looking like for you users who are experiencing this 😃. Now to debug and fix it. |
/cc @janwerkhoven you should subscribe to this issue. |
Published a patch to v0.29.5. I am keeping this issue open until I have confirmation it resolves the issues described above. Now, I really need to get back to writing my thesis 😜 ! Only 1 more day to go. |
Awesome! Thanks @Glavin001 ... I will test and report back. |
Serious problem with this new version @Glavin001.... Seems to be looping the save command.... Making video now... |
Shoot! I know what is going on. For some reason it stopped looping when I tested everything. |
@Glavin001 You might choose to push a version that disables 'Beautify On Save' altogether until you have time to resolve the issue...??? |
I just tested the new version and it randomly deletes all of the file contents like before. But it is no longer crashing atom. Also I held down First stack trace: https://gist.github.com/epelc/b004422105274bbcdd5f9dc1b8556a23 Atom: |
@Glavin001 Video uploading now... https://youtu.be/Nl6L-2nZ91g |
@Glavin001 best bet might be to rollback the recent change(I'm not sure if it causes issues in 1.6.2) and add a warning that 1.7.x is not supported yet. |
@emveeoh I see why it loops in yours and not in mine. Your Atom is adding a newline at the end of the file after each beautification which is then removed on beautification, and it loops until beautification has no changes to be saved. Working on a fix right now. |
Got a fix. Tested and working with the option |
Published a patch for the infinite loop at v0.29.6 Tested and working with the option |
Makes me wonder if this was the problem all along... Maybe, the original fs.write was working? Hmmm.... |
No, the infinite loop was my fault with the recent push of v0.29.5. I'm trying to recall why I even used The reason why this is this complicated in the first place is because of how Atom deals with saving. Atom-Beautify is asynchronous, beautifiers do not block Atom and can run in the background and can return later if necessary. Atom however expects the changes to the TextEditor, triggered by Anyway, hopefully it is all working now! The only issue with the current implementation is #935. |
Please post here to confirm that it is working for you. So I can sleep easy tonight 😜. Thank you. |
@Glavin001 working besides for the problem in #935 but that is minor. Maybe a fix for #935 and possibly the lag after multiple saves could be to cancel running beatifications when you save again and when you close a file. I haven't done anything with atom plugins so this may not work at all. But just a thought. |
Great job @Glavin001!! Works as expected.... Tested: JSON, LESS, SASS, SCSS, HTML CSS ... Smooth sailing... Best of luck on your exams/thesis! |
Works for me, too. Thanks so much for the spontaneous fix and good luck with your thesis. |
All good ! 👍 Thank you for your reactivity and good luck ! |
Update seems to work for me for JS & XML - However, my TSS ended up crashing with the same issue. I am on the updated version of Atom Beautify. If there is a need for me to give additional info, please let me know. |
@pinesy Could you please provide the generated debug.md file as a public gist, if possible? If that is not possible could you post a sample of the TSS code so that somebody can reproduce the problem? |
@Glavin001 I think this issue can be closed.. For me it is working perfectly fine. |
Description
Atom crashes with the code below if Beautify On Save is enabled
Expected Results
Atom should just save the file. :)
Error happens only if this part is in but this part alone does not cause the error to happen
Steps to Reproduce
Save with CMD + S
Debug
https://gist.github.com/meat147/982e1528972e4e6c234340feade905fa
Checklist
so I know this is not a duplicate issue
debug.md
Gist to this issueThe text was updated successfully, but these errors were encountered: