Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Atom Helper using 100% of CPU on Mac OS when escaping new lines '\' for a big string #410

Closed
kickthedragon opened this issue Jun 8, 2017 · 4 comments
Labels

Comments

@kickthedragon
Copy link

kickthedragon commented Jun 8, 2017

Hey,

I'm running into an issue where the atom helper uses 100% of my Mac's CPU. I'm using a late 2015 on macOS Sierra. I've narrowed down the conditions and the plugin to linter-jshint (since when its disabled this problem doesn't occur).

The issue happens when i'm escaping a string to a new line with the \

Below is an example where i'm posting a big XML string, and for readability i'm escaping each tag with a new line:

request({
		method: 'POST',
		headers: {
			'SOAPAction': 'http://omscom/AddOrder',
			'Content-Type': 'text/xml; charset=utf-8'
		},
		uri: this.uri,
		body: '<?xml version="1.0" encoding="utf-8"?>\
		<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">\
			<soap:Header>\
				<DebugHeader xmlns="http://omscom/">\
					<Debug>' + this.debug + '</Debug>\
					<Request/>\
				</DebugHeader>\
				<AuthenticationHeader xmlns="http://omscom/">\
					<Username>' + this.username + '</Username>\
					<Password>' + this.password + '</Password>\
				</AuthenticationHeader>\
			</soap:Header>\
etc.......

As soon as I get 2 or 3 escapes \ in there is when the problem starts.

Let me know any steps I can take to further debug the situation, and provide you with requested information.

Best Regards,

@Arcanemagus
Copy link
Member

How large is this file? It looks like you are using tabs for indentation, and currently there is a bug with JSHint that causes most lines indented with tabs to report an invalid point. Each invalid point currently causes a call out to check the JSHint version in use which might be causing the high load if this file is quite large.

@Arcanemagus
Copy link
Member

I've implemented caching of the debug information in #418, that should cut this down to only the time it takes to run JSHint itself, and a minimal overhead regardless of how many errors that file is triggering.

@Arcanemagus
Copy link
Member

Published in v3.1.4.

Note that the reason there are so many invalid point warnings, and that your system was getting overwhelmed gathering the information for them is due to JSHint breaking on virtually all tab indented lines. I've filed jshint/jshint#3151 to get that fixed there.

@kickthedragon
Copy link
Author

Thank you, i switched to spaces instead of tab indentations as well. It seems to be working much better.

Best Regards,

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants