Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Hangs on code reformat on Mac OS #56

Open
timothybasanov opened this Issue · 9 comments

4 participants

@timothybasanov

I've created simple project rooted at ~/Documents/Erlang with only one file:
~/Documents/Erlang/test/src/test.app.src/test.erl

-module(test).

-export([start/0]).

start() ->
  "1".

When I try to reformat it, Sublime hangs, quits only on Forced Quit.

Not sure how to provide more useful information.

Date/Time:       2013-02-20 20:42:40 -0800
OS Version:      10.8.2 (Build 12C3012)
Architecture:    x86_64
Report Version:  11

Command:         Sublime Text 2
Path:            /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
Version:         Version 2.0.1, Build 2217 (2217)
Parent:          launchd [465]

PID:             94188
Event:           hang
Duration:        1.17s
Steps:           12 (100ms sampling interval)

Hardware model:  MacBookAir5,2
Active cpus:     4
Free pages:      819957 pages (+1304)
Pageins:         0 pages
Pageouts:        0 pages


Process:         Sublime Text 2 [94188]
Path:            /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
Architecture:    x86_64
Parent:          launchd [465]
UID:             54686
Task size:       11267 pages

  Thread 0x42040f   DispatchQueue 1          priority 46        
  12 start + 52 (Sublime Text 2) [0x10d8cd064]
    12 main + 2251 (Sublime Text 2) [0x10d9be3cb]
      12 -[NSApplication run] + 636 (AppKit) [0x7fff8db362fa]
        12 -[NSApplication sendEvent:] + 4480 (AppKit) [0x7fff8dc20243]
          12 -[NSApplication _handleKeyEquivalent:] + 462 (AppKit) [0x7fff8dd63114]
            12 -[NSWindow performKeyEquivalent:] + 64 (AppKit) [0x7fff8dd63329]
              12 -[NSView _performKeyEquivalent:conditionally:] + 41 (AppKit) [0x7fff8dd633c9]
                12 -[NSView performKeyEquivalent:] + 166 (AppKit) [0x7fff8dd63512]
                  12 -[NSView _performKeyEquivalent:conditionally:] + 41 (AppKit) [0x7fff8dd633c9]
                    12 ??? (Sublime Text 2 + 2489896) [0x10db2ae28]
                      12 window_impl::handle_event(px_event_t*) + 6795 (Sublime Text 2) [0x10d94118f]
                        12 route_message_using_input_focus(ui_message_type, void*, control*) + 151 (Sublime Text 2) [0x10d8ef547]
                          12 message_handler::handle_message(ui_message_type, void*) + 652 (Sublime Text 2) [0x10d90e6f4]
                            12 python_command::run(value const&) + 131 (Sublime Text 2) [0x10da0cb2d]
                              12 PyEval_CallFunction + 183 (Python) [0x10e2bb80a]
                                12 PyEval_CallObjectWithKeywords + 177 (Python) [0x10e292dfc]
                                  12 PyObject_Call + 97 (Python) [0x10e28baba]
                                    12 ??? (Python + 188826) [0x10e2a619a]
                                      12 PyObject_Call + 97 (Python) [0x10e28baba]
                                        12 ??? (Python + 348024) [0x10e2ccf78]
                                          12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                                            12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                              12 ??? (Python + 112107) [0x10e2935eb]
                                                12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                                  12 ??? (Python + 112107) [0x10e2935eb]
                                                    12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                                      12 ??? (Python + 112107) [0x10e2935eb]
                                                        12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                                          12 ??? (Python + 112107) [0x10e2935eb]
                                                            12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                                              12 ??? (Python + 112225) [0x10e293661]
                                                                12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                                                                  12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                                                    12 ??? (Python + 112107) [0x10e2935eb]
                                                                      12 PyEval_EvalFrameEx + 7548 (Python) [0x10e28f041]
                                                                        12 __select + 10 (libsystem_kernel.dylib) [0x7fff8c4c4322]
                                                                         *12 ??? (mach_kernel + 3576576) [0xffffff8000569300]

  Thread 0x42041c   DispatchQueue 2          priority 48        
  12 _dispatch_mgr_thread + 54 (libdispatch.dylib) [0x7fff8c4a09ee]
    12 kevent + 10 (libsystem_kernel.dylib) [0x7fff8c4c4d16]
     *12 ??? (mach_kernel + 3467616) [0xffffff800054e960]

  Thread 0x42041e   priority 46        
  12 thread_start + 13 (libsystem_c.dylib) [0x7fff8bd96181]
    12 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8bda9742]
      12 ??? (Sublime Text 2 + 56745) [0x10d8d8da9]
        12 thread_queue_runner::run() + 97 (Sublime Text 2) [0x10d8d8f7b]
          12 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8c4c40fa]
           *12 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

  Thread 0x42041f   priority 46        
  12 thread_start + 13 (libsystem_c.dylib) [0x7fff8bd96181]
    12 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8bda9742]
      12 ??? (Sublime Text 2 + 90745) [0x10d8e1279]
        12 io_worker::thread_proc() + 155 (Sublime Text 2) [0x10d8e1253]
          12 io_scheduler::extract_next_request() + 148 (Sublime Text 2) [0x10d8e1184]
            12 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8c4c40fa]
             *12 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

  Thread 0x420420   priority 46        
  12 thread_start + 13 (libsystem_c.dylib) [0x7fff8bd96181]
    12 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8bda9742]
      12 ??? (Sublime Text 2 + 90745) [0x10d8e1279]
        12 io_worker::thread_proc() + 155 (Sublime Text 2) [0x10d8e1253]
          12 io_scheduler::extract_next_request() + 148 (Sublime Text 2) [0x10d8e1184]
            12 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8c4c40fa]
             *12 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

  Thread 0x420465   priority 46        
  12 thread_start + 13 (libsystem_c.dylib) [0x7fff8bd96181]
    12 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8bda9742]
      12 ??? (Python + 446480) [0x10e2e5010]
        12 PyEval_CallObjectWithKeywords + 177 (Python) [0x10e292dfc]
          12 PyObject_Call + 97 (Python) [0x10e28baba]
            12 ??? (Python + 188826) [0x10e2a619a]
              12 PyObject_Call + 97 (Python) [0x10e28baba]
                12 ??? (Python + 348024) [0x10e2ccf78]
                  12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                    12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                      12 ??? (Python + 112107) [0x10e2935eb]
                        12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                          12 ??? (Python + 112107) [0x10e2935eb]
                            12 PyEval_EvalFrameEx + 2452 (Python) [0x10e28dc59]
                              12 PyObject_Call + 97 (Python) [0x10e28baba]
                                12 ??? (Python + 348024) [0x10e2ccf78]
                                  12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                                    12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                      12 ??? (Python + 112225) [0x10e293661]
                                        12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                                          12 PyEval_EvalFrameEx + 7693 (Python) [0x10e28f0d2]
                                            12 ??? (Python + 112225) [0x10e293661]
                                              12 PyEval_EvalCodeEx + 1956 (Python) [0x10e28d281]
                                                12 PyEval_EvalFrameEx + 7548 (Python) [0x10e28f041]
                                                  12 ??? (Python + 445416) [0x10e2e4be8]
                                                    12 PyThread_acquire_lock + 96 (Python) [0x10e2de54e]
                                                      12 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8c4c40fa]
                                                       *12 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

Process:         bash [94209]
Path:            /bin/bash
Architecture:    x86_64
Parent:          login [94208]
UID:             54686
Task size:       305 pages

Process:         beam.smp [94212]
Path:            /usr/local/lib/erlang/erts-5.10/bin/beam.smp
Architecture:    x86_64
Parent:          bash [94209]
UID:             54686
Task size:       4637 pages


Process:         beam.smp [94222]
Path:            /usr/local/lib/erlang/erts-5.10/bin/beam.smp
Architecture:    x86_64
Parent:          Sublime Text 2 [94188]
UID:             54686
Task size:       6079 pages (-32)
CPU Time:        1.078s
@ostinelli
Owner

Not sure how to look into this. Any idea on how to reproduce it? What version of Erlang are you using?

@timothybasanov
@frepond

The same happens here under Ubuntu with R16B from Erlang Solutions.

@ostinelli
Owner

Does all the rest of the plugin actually work? Or is it only the code reformat?

@frepond

Yes, the rest works just fine. Only formatting seems to have problem under Erlang Solution's R15 and R16.

@ostinelli
Owner

Ok thank you.

@kgadek

Ok, so I found a problematic command -- it's retcode, data = SUBLIMERL.execute_os_command('%s %s' % (SUBLIMERL.escript_path, escript_command)) in sublimerl_formatter.py in line 54. It calls /usr/local/bin/escript sublimerl_formatter.erl '/some_path_here/tmpl5fUjO', the temp file is (obviously?) equal to test.erl and yet the escript command never finishes.

What's weird: escript is stuck at compiling the file. Very strange. I think I saw something related on some erlang mailing list.

Yet SublimErl seem ok, issue to be closed. If I'd find anything, I'll leave further notes here.

@kgadek

Ok, found it quicker than I expected: http://erlang.org/pipermail/erlang-bugs/2013-March/003454.html

The module (distilled here: http://pastebin.com/2Q1m3beB ) takes 120s to compile (so we thought it's hanged). On the mailing list is distilled module from vimerl which is also problematic.

The problem was introduced R16A/B and shall be fixed in R16B01 (on R15B03 everything works just fine).

--edit--
A quickfix: comment-out -mode(compile). line. Diff below:

--- a/support/sublimerl_formatter.erl
+++ b/support/sublimerl_formatter.erl
@@ -30,7 +30,7 @@
 %% NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 %% POSSIBILITY OF SUCH DAMAGE.
 %% ==========================================================================================================
--mode(compile).
+%-mode(compile).

 % macros
 -define(IS(T, C), (element(1, T) == C)).
@ostinelli
Owner

Thank you for this. Will update the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.