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

Large objects deadlock autocompletion #9

Open
TimothyGu opened this issue Jun 23, 2018 · 3 comments
Open

Large objects deadlock autocompletion #9

TimothyGu opened this issue Jun 23, 2018 · 3 comments

Comments

@TimothyGu
Copy link
Member

https://github.com/devsnek/node-repl-prototype/blob/5e72bed5a127c0b3e1c7289d75c3eb157db43522/src/repl.js#L146-L149

getProperties doesn't allow any sort of timeout, so it will take forever for an object like Array(1000000).fill(0)

@antsmartian
Copy link
Contributor

antsmartian commented Jul 18, 2018

Ok this is interesting. I'm not sure, why we do call onAutocomplete when user types in .? Also, the same code snippet works perfectly fine in normal repl along with proper tab completion. A quick question here can't we simply use Object.getOwnPropertyNames() to get the list of method names here rather than using Runtime.getProperties are there any advantages here?

@devsnek
Copy link
Member

devsnek commented Aug 21, 2018

I'm going to try and add a timeout to Runtime.getProperties

@cactysman
Copy link

cactysman commented Aug 16, 2019

I'm not too experienced with child processes in NodeJS (child_process module), but would moving autocompletion / eager evaluation to a killable fork make sense?
The result would then be shown asynchronously.

When the input is submitted or is changed to something syntactically different (if there's efficient ways to check this, something like removing a semicolon at the very end shouldn't re-trigger it), the fork could be killed off and the new thing would be evaluated.

Example from the Chrome devtools (although they don't kill it if it doesn't complete quickly enough but instead it clogs the main process):
tWgD3PXeW5

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

4 participants