In atom-beautify v0.30.1 beautification with autopep8 will regularly (but not always :confused:) cause Atom to lockup (only for Beautification with autopep8, Beautification with uncrustify is fine for C++ files) and need me to manually kill it from the command line.

Atom Beautify: Beautify Editor so that beautification with autopep8 occursThe freeze happens when running in debug mode too, so no error logs output can be generated.
I have:
Atom Beautify: Help Debug Editor command in Atom and added link for debug.md Gist to this issueI have similar problem with javascript. If the code is more complexed, with a lot of functions, Atom freezes after pressing CTRL+ALT+B (Atom-beautify version 0.30.1). CPU is then 100%. I didn't have problems with 0.29.x version. The only solution is to kill Atom process.
I do expect first load / beautification to take some time. I always find first load very slow -- a couple seconds -- and subsequent loads are fast, since the executable paths are cached.
I have no experienced this before. What version of Atom are you each using? I'll try again later to reproduce, however our CI builds are passing:
This is what is being tested for Python + autopep8: https://github.com/Glavin001/atom-beautify/blob/master/examples/nested-jsbeautifyrc/python/original/test.py
Could you try that Python file?
@zajc : JavaScript is handled differently than autopep8. I would expect it to be relatively quick.
I did update the js-beautify dependency: https://github.com/Glavin001/atom-beautify/blame/master/package.json#L168
Could you try to generate a debug.md Gist so I can see what your configuration is and narrow down the issues?
Thanks!
I have the same problem with Ruby, but I'm also unable to debug it, because the editor freezes...
@Glavin001 I am using Atom (Linux distro) version 1.17.2.
$ atom --version
Atom : 1.17.2
Electron: 1.3.15
Chrome : 52.0.2743.82
Node : 6.5.0
also (though I don't think it is relevant):
$ uname -a
Linux ThinkPad-Edge-E540 4.4.0-79-generic #100-Ubuntu SMP Wed May 17 19:58:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
I have been able to successfully reproduce the error in the following way: opening the file from the command line. That is, if I do
$ atom test.py
and then beautify (either by the Packages drop down menu) or by executing ctrl-alt-b I get the same freezing behavior where my CPU goes up to 100% and Ubutnu 16.04 eventually will ask to kill the process (if I haven't already from the command line).
However, if I open Atom from the Unity Launcher icon, and then open the file from within Atom everything is fine. I can spam ctrl-alt-b and atom-beautify handles everything just fine and is able to beautify your test.py successfully.
However, if I open Atom from the Unity Launcher icon, and then open the file from within Atom everything is fine. I can spam ctrl-alt-b and atom-beautify handles everything just fine and is able to beautify your test.py successfully.
Oooh, that's interesting! I think this would be equivalent to how I personally run Atom on my Mac (via Finder). I will try using atom FILENAME instead and seeing if there are some interesting branches followed. Thank you for your research!!
I have the same problem with php-cs-fixer after today update.
I've just checked to make sure what I reported holds true (on my machine at least) with Atom 1.18.0 (which just appeared in apt update) and it does. That is, the freeze/crash still occurs when Atom is opened from the command line, and it does not occur (atom-beautify works correctly) when Atom is opened from the Launcher/Finder and the file is then opened from inside Atom.
$ atom --version
Atom : 1.18.0
Electron: 1.3.15
Chrome : 52.0.2743.82
Node : 6.5.0
JavaScript. I cannot create debug.md beacuse Atom editor freezes after pressing CTRL+ALT+B.
$ atom --version
Atom : 1.18.0
Electron: 1.3.15
Chrome : 52.0.2743.82
Node : 6.5.0
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
Ok thanks for trying @zajc.
@foutrelis did some investigation and discovered an issue with bash -ilc env call:
Starting with v0.30.0, atom-beautify hangs while beautifying code (tried C and Go files). There is a
bash -ilc envprocess that uses 100% of one core while other cores are tied up by Atom/Electron processes.Doing a quick
git bisectshows commit bc21afd424728591ea45eb8c1153df0a1b719a70 as the first commit that displays this behavior.I'm using Atom 1.18 (running on Electron 1.4.16) on Arch Linux x86_64.
This is interesting because the bash -ilc env call should be non-blocking and was also being used before Executables in the older code. I think we can move towards removing it. The problem is environment variables such as PATH are not correctly loaded by Atom/Electron. However, maybe this has changed since this feature was added to Atom-Beautify! :crossed_fingers:
Great news! Looks like Atom already does the same thing Atom-Beautify does to load the environment variables correctly! See https://github.com/atom/atom/blob/7b1aadc9b361c4e6257f88d94fe9bf531341a407/src/update-process-env.js#L79
This means I can simply remove the code from Atom-Beautify and expect the process.env to work correctly! 馃巻 馃槂 Fix coming later!
Oh and looks like Atom itself had the same issue! https://github.com/atom/atom/issues/13084
Having problems with tests: https://discuss.atom.io/t/specs-do-not-load-shell-environment-variables-activationhooks-core-loaded-shell-environment/44199
Blocked by this. Once resolved, I can merge fix. Thanks everyone for your patience!
Same issue here, 100% disk usage in my machine and atom freezes. The interesting is that when running within my Vagrant box there is no problem at all!
I have not heard of a great fix yet. I am going to patch the specs using the old method Atom-Beautify was using -- which works for me, Travis CI, and AppVeyor 馃憤 -- and remove it for the package itself such that you guys should no longer have issues! Working on this now. Wish me luck! 馃槃
@Glavin001 Many thanks for quickly going after this!
Get ready for testing! Just waiting for CI builds to finish: https://github.com/Glavin001/atom-beautify/pull/1735
Published to v0.30.3
Please test and let me know if it works or does not work. Thanks!
After the upgrade to v0.30.3 I'm experiencing the same (CPU 100%, freeze) behaviour when trying to beautify the JavaScript code.
Edit: If JavaScript code is not complex it can be beautified. When it has (a lot of) functions the Editor freezes when CTRL+ALT+B is pressed.
@Glavin001 Everything is working as expected now with atom-beautify v0.30.3 and
$ atom --version
Atom : 1.18.0
Electron: 1.3.15
Chrome : 52.0.2743.82
Node : 6.5.0
Many thanks! I've tested with your test.py example (with opening from the command line, atom test.py) and also confirmed that it works on much larger things like xAODAnaHelpers's python scripts. :+1: I'll report back if I find anything that breaks it, but I think for now beautifying python is working.
Most helpful comment
Published to v0.30.3