pty.js
pty.js copied to clipboard
100% CPU usage when pty stays on for long
I have created a pseudo bash Terminal which uses pty.js in the backend.
I am seeing that sometimes the server shoots to 100% CPU for one core & it stays there till the Node server is restarted.
It is a multi user setup & when a user connects pty spaws with 'su -l
Server - Ubuntu 12.04 64 bit AMD
npm version
{ http_parser: '1.0', node: '0.10.17', v8: '3.14.5.9', ares: '1.9.0-DEV', uv: '0.10.14', zlib: '1.2.3', modules: '11', openssl: '1.0.1e', npm: '1.3.8', 'terminal-codelearn': '0.0.3' }
Have you guys made any progress on this? Here's a v8 prof dump from a server that hits 100% cpu using pty.js: https://gist.github.com/vincentwoo/7797905
My dump looked similar. So far no success in getting this resolved.
Ashish (Pocha) | Codelearn.org Learn Ruby on Rails by creating an app right in the browser Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Thursday, 5 December 2013 at 5:35 am, Vincent Woo wrote:
Have you guys made any progress on this? Here's a v8 prof dump from a server that hits 100% cpu using pty.js: https://gist.github.com/vincentwoo/7797905
— Reply to this email directly or view it on GitHub (https://github.com/chjj/pty.js/issues/39#issuecomment-29859386).
For posterity: in researching this issue I discovered this commit from the "terminal" package for atom, which fixes this issue by running the pty.js process in its own child_process
instead of the main process, I guess because of some bad interaction between the pty process and the main event loop.
I don't understand fully, but by copying the idea of this commit, I was able to avoid the high CPU usage problem and still communicate with the pty process.
https://github.com/atom-archive/terminal/commit/f945a35f84aeb3c8e1f52d79a3af24bf47634ea2