microsoft / node-pty

Fork pseudoterminals in Node.JS
Other
1.48k stars 244 forks source link

ioctl(2) failed exception #220

Open Tyriar opened 6 years ago

Tyriar commented 6 years ago

Maybe the pty has already been destroyed?

Stack 
Error: ioctl(2) failed.
at UnixTerminal.resize (/node_modules.asar/node-pty/lib/unixTerminal.js:227:13)
/vs/workbench/parts/terminal/node/terminalProcess.ts#123:19 (resize)
/vs/workbench/parts/terminal/electron-browser/terminalProcessManager.ts#158:17 (setDimensions)
/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts#999:72 (onComplete)
/vs/base/common/winjs.base.js#1191:0 (_notify)
/vs/base/common/winjs.base.js#867:0 (enter)
/vs/base/common/winjs.base.js#1089:0 (_run)
/vs/base/common/winjs.base.js#1057:0 (c)
/vs/workbench/parts/terminal/electron-browser/terminalProcessManager.ts#63:4 (call)
/vs/base/common/event.ts#140:15 (fire)
/vs/workbench/parts/terminal/electron-browser/terminalProcessManager.ts#132:24 (call)
/vs/base/common/event.ts#140:15 (fire)
/vs/workbench/parts/terminal/node/terminalProcess.ts#104:25 (_sendProcessId)
/vs/workbench/parts/terminal/node/terminalProcess.ts#69:8

VS Code issue: https://github.com/Microsoft/vscode/issues/57976

jerch commented 6 years ago

@Tyriar: Hard to say, this error will be thrown whenever the file descriptor fd is invalid: https://github.com/Microsoft/node-pty/blob/1c3cd4710c48ad45615da562d10d76162ad43c39/src/unix/pty.cc#L368

Possible reasons:

Any more info when this exactly happens?

Might be useful to output errno to see the actual error.

Tyriar commented 6 years ago

No more info unfortunately, these are just errors that we're seeing in the wild.

Tyriar commented 5 years ago

I don't see how this could happen atm as this._fd is synchronously in the ctor and resize must have been called after it, but the repro in https://github.com/Microsoft/vscode/issues/71078 seems to indicate that resizing again will fix it.

Tyriar commented 5 years ago

Adding a better error that should reveal why the call failed in https://github.com/Microsoft/node-pty/pull/285