Skip to content
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

Out of bounds error when idle #457

Closed
samdmarshall opened this issue Nov 18, 2016 · 13 comments
Closed

Out of bounds error when idle #457

samdmarshall opened this issue Nov 18, 2016 · 13 comments

Comments

@samdmarshall
Copy link
Contributor

Description of the problem or steps to reproduce

Today I have been working in a file on and off and have seen this problem a few times where I get dropped out of the micro UI and back to my command line with an error message:

runtime error: index out of range
stack traceback:
    [G]: in function 'sub'
    <string>:7: in function 'charAt'
    <string>:81: in main chunk
    [G]: ?

Press enter to continue

and

runtime error: index out of range
stack traceback:
    <string>:30: in function 'runLinter'
    <string>:44: in main chunk
    [G]: ?

Press enter to continue

In both cases pressing enter returns me to the micro editor, then the cursor flickers for a few seconds and the process repeats and I get stuck in a loop like this until i can hit enter and mash control+q fast enough to quit micro before it drops back out to the "press enter to continue" prompt again.

Both the times I experienced this I was idle in the editor (not typing anything, just reading code), which was odd to me given the stack traces that were give. If it matters, the language of the file being viewed was Python 3.

I don't know if it is possible to write out these errors to some sort of log file, that might make it easier to get an accurate read for issues that aren't necessarily reproducible.

Specifications

ProductName: Mac OS X
ProductVersion: 10.12.1
BuildVersion: 16B2555

Version: 1.1.2
Commit hash: c04a4ba
Compiled on October 24, 2016

@zyedidia
Copy link
Owner

This is someone being caused by the linter. I'm not sure how, but it seems like the autoclose plugin is also involved. I'll have to take a closer look.

@samdmarshall
Copy link
Contributor Author

I'm seeing this more frequently now, especially when leaving micro open overnight. Any clues as to what the root causes of this is/anything I can do to provide more info?

@samdmarshall
Copy link
Contributor Author

@zyedidia could you give me some more info on this, I think I would like to look into fixing it myself but i'm not sure where to start.

@zyedidia
Copy link
Owner

Sure. I'm not able to reproduce it, but the problem seems to be coming from both the linter plugin and the autoclose plugin. The first error is from an out-of-bounds error on line 76.

The second error is in the linter plugin. The error is coming from line 27 (which makes sense since you were using python). I find it hard to believe that line 27 is actually causing the error. The issue is actually probably happening in the onExit function, but I'm not sure.

@samdmarshall
Copy link
Contributor Author

OK, that is interesting, I don't use pyflakes nor have it installed, so line 27 of the linter plugin shouldn't even be run?

@zyedidia
Copy link
Owner

Alright. There should probably be some sort of check to see if you have the linter installed, although even without pyflakes installed I'm not getting any index out of range errors. Maybe this was fixed in a recent version when I changed the linter plugin to use JobSpawn instead of JobStart. I still don't know how this has anything to do with the autoclose plugin.

@samdmarshall
Copy link
Contributor Author

I left micro running overnight and I was able to get it to happen again:

runtime error: index out of range
stack traceback:
	<string>:46: in main chunk
	[G]: ?

Press enter to continue

I'm still not sure what this stacktrace means though.

@GeigerCounter
Copy link
Contributor

@zyedidia I'm not really so well versed in lua, but the autoclose function seems to allow for invalid values of i in certain cases when #str stops being able to accurately measure the length of the string passed, so basically what I think is happening is say #str is 11 bytes long, and i is 12 ( or perhaps 0 or a negative number ), so when you call the substitute function it's trying to make an illegal function. Since it's been rather difficult to pinpoint what exactly triggers this errant behaviour, it'll be difficult to debug, but I can make some changes that I have a hunch will fix it. Still not sure about the problems with the linter, but it's become more and more apparent that the debugger for the lua scripts needs to referrence the erring script by name so we can keep straight who's causing what bug. I'll look into implementing said behaviour. Hooray for making the best of a sick day!

@GeigerCounter
Copy link
Contributor

@zyedidia http://stackoverflow.com/questions/17974622/what-does-mean-in-lua/17974661
Possibly relevant if there's freak cases where the string can have a null char in it.

@GeigerCounter
Copy link
Contributor

@samdmarshall Did you have softwrapping on when these errors occured?

@samdmarshall
Copy link
Contributor Author

samdmarshall commented Mar 14, 2017 via email

@GeigerCounter
Copy link
Contributor

@samdmarshall I don't know for certain, but I'm wondering if softwrapping might have something to do with it.

@samdmarshall
Copy link
Contributor Author

I don't know, i've ruled out the auto-close plugin so I don't know what else might be causing this.

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

No branches or pull requests

3 participants