BUG: Adding "//" comment to Javascript file crashes Atom


#1

Atom version: 0.81.0
Platform: OSX Mavericks (10.9.2)

Repro:

  1. Open Javscript file with ~350 lines (this is the test case I’m using)
  2. Within an object literal (i.e. {}) add a comment using “//”

Notice:
After the first “/” Atom freezes, eventually throws a “Atom is not repsonding: Wait or Close”, and then fully crashes

Expect:
Ability to type “//” where ever you want without crashing

Occurrence Frequency:
Always

Note: I could NOT repro this with an untitled, unsaved file.


Crash Log:
Process:         Atom [58926]
Path:            /Applications/Atom.app/Contents/MacOS/Atom
Identifier:      com.github.atom
Version:         0.81.0 (0.81.0)
Code Type:       X86-64 (Native)
Parent Process:  launchd [276]
Responsible:     Atom [58926]
User ID:         501

Date/Time:       2014-04-01 10:52:04.934 -0700
OS Version:      Mac OS X 10.9.2 (13C64)
Report Version:  11
Anonymous UUID:  31D081EF-7A66-B09B-4F4C-B195DEADF05B

Sleep/Wake UUID: 34B68063-48F2-4A55-8911-62C901AE1CEE

Crashed Thread:  0  CrBrowserMain  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   com.github.AtomFramework      	0x000000010ec54513 -[BRYInspectableWebContentsView window:didBecomeActive:] + 64
1   com.apple.CoreFoundation      	0x00007fff8eb98e0c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
2   com.apple.CoreFoundation      	0x00007fff8ea8ca6d _CFXNotificationPost + 2893
3   com.apple.Foundation          	0x00007fff98d5c7ba -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
4   com.apple.AppKit              	0x00007fff94a6e760 -[NSWindow resignKeyWindow] + 702
5   com.apple.AppKit              	0x00007fff94b89771 -[NSWindow _resignKeyFocus] + 89
6   com.apple.AppKit              	0x00007fff949cd8f0 -[NSApplication sendEvent:] + 2545
7   com.github.AtomFramework      	0x000000010ec3341e -[AtomApplication sendEvent:] + 63
8   com.apple.AppKit              	0x00007fff9481db89 -[NSApplication run] + 646
9   libchromiumcontent.dylib      	0x000000010f2f173a 0x10f2cc000 + 153402
10  libchromiumcontent.dylib      	0x000000010f2f0f4c 0x10f2cc000 + 151372
11  libchromiumcontent.dylib      	0x000000010f3411f2 base::MessageLoop::RunInternal() + 226
12  libchromiumcontent.dylib      	0x000000010f35ed8a base::RunLoop::Run() + 26
13  libchromiumcontent.dylib      	0x000000010f3b2c59 content::BrowserMainLoop::MainMessageLoopRun() + 233
14  libchromiumcontent.dylib      	0x000000010f3b2b45 content::BrowserMainLoop::RunMainMessageLoopParts() + 69
15  libchromiumcontent.dylib      	0x000000010f3b50ee 0x10f2cc000 + 954606
16  libchromiumcontent.dylib      	0x000000010f3aed67 content::BrowserMain(content::MainFunctionParams const&) + 167
17  libchromiumcontent.dylib      	0x000000010f2dec35 0x10f2cc000 + 76853
18  libchromiumcontent.dylib      	0x000000010f2df8d3 0x10f2cc000 + 80083
19  libchromiumcontent.dylib      	0x000000010f2dea06 content::ContentMain(int, char const**, content::ContentMainDelegate*) + 70
20  com.github.AtomFramework      	0x000000010ec21d2b AtomMain + 43
21  libdyld.dylib                 	0x00007fff937bc5fd start + 1

...

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 6
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 173265
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=282.9M resident=263.1M(93%) swapped_out_or_unallocated=19.8M(7%)
Writable regions: Total=340.3M written=19.6M(6%) resident=60.4M(18%) swapped_out=0K(0%) unallocated=279.8M(82%)
 
REGION TYPE                      VIRTUAL
===========                      =======
CG backing stores                  9132K
CG image                             32K
CG raster data                     17.2M
CG shared images                    276K
CoreAnimation                         4K
CoreGraphics                          4K
CoreImage                            68K
CoreServices                         16K
Foundation                            4K
IOKit                              41.3M
IOKit (reserved)                      4K        reserved VM address space (unallocated)
Image IO                             64K
Kernel Alloc Once                     8K
MALLOC                            144.1M
MALLOC (admin)                       32K
Mach message                          4K
Memory Tag 242                       12K
Memory Tag 251                        8K
Memory Tag 255                    557.5M
OpenCL                              112K
OpenGL GLSL                        3840K
SQLite page cache                   256K
STACK GUARD                        56.1M
Stack                             125.1M
VM_ALLOCATE                        20.6M
__DATA                             44.8M
__IMAGE                             528K
__LINKEDIT                         76.3M
__TEXT                            206.6M
__UNICODE                           544K
mapped file                        62.1M
shared memory                        68K
===========                      =======
TOTAL                               1.3G
TOTAL, minus reserved VM space      1.3G
 

Model: MacBookPro10,1, BootROM MBP101.00EE.B03, 4 processors, Intel Core i7, 2.4 GHz, 16 GB, SMC 2.3f36
Graphics: Intel HD Graphics 4000, Intel HD Graphics 4000, Built-In, 1024 MB
Graphics: NVIDIA GeForce GT 650M, NVIDIA GeForce GT 650M, PCIe, 1024 MB
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D5434314753364D465238432D50422020
Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D5434314753364D465238432D50422020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xEF), Broadcom BCM43xx 1.0 (5.106.98.100.22)
Bluetooth: Version 4.2.3f10 13477, 3 services, 23 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SD256E, 251 GB
USB Device: Hub
USB Device: Hub
USB Device: Apple Internal Keyboard / Trackpad
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
USB Device: Hub
USB Device: iPhone
USB Device: FaceTime HD Camera (Built-in)
Thunderbolt Bus: MacBook Pro, Apple Inc., 23.4

Try to comment a line in Javascript with // stalls the editor complete
#2

Just tried this myself (1227 line JS file, same OS and atom version) and I have no issue here…


#3

Are you willing to provide the specific javascript file you are using, and where you put the // ?

Obviously you could try cutting it down, or doing some search+replace, if you don’t want to share it’s contents.


#4

I’m facing this issue as well. Here is a snippet of my js file

var apiUrl = 'http://localhost:5000/v1';
//var apiUrl = 'http://api.blahblah.com/v1';


var app = angular.module('blahblah-frontend', [
  'ngRoute',
  //'Admin.Controllers',
])

The problem is quite inconsistent and kinda unbearable at time since I have to save the file every time before commenting a line.

hope this helps.


#5

Hi,

Has there been any fix for this? I recently updated to .86 and the issue seems to be still there.

Thanks


#6

I’m on 0.92, and the bug is still here. It’s killing me. I’m writing a doc generator, so I’m writing comments in source files all the time. It’s really unbearable. If I have time, I’m going to try to limit the bug to a specific plugin, and I’ll report back here if I find anything.

Also, I don’t think the issue is size related, but it does seem to only happen when adding a comment to a blank line. Try adding two comments to the beginning of this: (note: start with a blank line at the top rather than prepending to the first comment)


/// The parser's job is to read some source and extract the markdown. The hard part of the parsing
/// is handled by a packrat parser generated from `grammar/docparser.peg`. This module wraps the
/// parser to provide a higher-level interface.

var docparser = require('../grammar/docparser');


docparser.Parser.DocBlock = {
	isDocBlock: true,

	// Extracts the markdown from the node.
	getDocs: function () {
		var docs = '';
		this.elements.forEach(function (line) {
			docs += line.docs.textValue;
		})
		return docs;
	}
}


/// `parse(source)`
/// --------------------------------------------------
/// **TODO**: Summary
///
/// ### Arguments
/// 1. `source` *(String)*: The source code to parse.
///
/// ### Returns
/// *(Array of Strings)*: The blocks of markdown documentation in the source.

exports.parse = function (source) {

	// Parse the source into an Abstract Syntax Tree.
	var ast = docparser.parse(source);

	// Build HTML output from the doc blocks.
	var docs = [];
	ast.elements.forEach(function (block) {
		if (block.isDocBlock) {
			docs.push(block.getDocs());
		}
	})

	return docs;
}

Please, if anyone has any info on this, help us out!

UPDATE: Everything seems to work when I disable language-javascript. And the bug only seems to appear when I create a new line, then go back up to add a comment. I posted on the issue tracker: https://github.com/atom/language-javascript/issues/26


#7

This happens to me all the damn time, and its usually trying to do more than one / in multiselect.

I get this error.

Uncaught TypeError: Cannot call method ‘split’ of undefined
/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:99

However, sometimes its not in multiselect, but just multiple slashes.

So annoying.