node-pty icon indicating copy to clipboard operation
node-pty copied to clipboard

ioctl(2) failed exception

Open Tyriar opened this issue 7 years ago • 4 comments
trafficstars

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

Tyriar avatar Sep 05 '18 17:09 Tyriar

@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:

  • fd is something else (not a pty master at all)
  • pty already closed and fd is stale
  • fd number got reattched to something else (e.g. some other file)

Any more info when this exactly happens?

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

jerch avatar Sep 05 '18 22:09 jerch

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

Tyriar avatar Sep 10 '18 17:09 Tyriar

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 avatar May 01 '19 21:05 Tyriar

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

Tyriar avatar May 01 '19 21:05 Tyriar