Xterm.js: Renderer crash when resizing terminal with text-wrap

Created on 2 Feb 2019  路  5Comments  路  Source: xtermjs/xterm.js


Details

  • Browser and browser version: Chrome 71.0.3578.98, Safari 12.0.2 (14606.3.4), Firefox 65.0
  • OS version: Windows 10 & macOS Mojave
  • xterm.js version: v3.11.0

Steps to reproduce

  1. Visit: https://4jnl8qxxn4.codesandbox.io/
  2. Open browser dev console
  3. Click "Play Example" button
  4. Observe TextRenderLayer crash

Error trace copied below:

Uncaught TypeError: Cannot read property 'get' of undefined
    at TextRenderLayer._forEachCell (TextRenderLayer.js:51)
    at TextRenderLayer._drawBackground (TextRenderLayer.js:101)
    at TextRenderLayer.onGridChanged (TextRenderLayer.js:164)
    at eval (Renderer.js:166)
    at Array.forEach (<anonymous>)
    at Renderer._renderRows (Renderer.js:166)
    at RenderDebouncer._innerRefresh (RenderDebouncer.js:31)
    at eval (RenderDebouncer.js:26)

This only started with v3.11.0, this did not happen in v3.10.1 (I've gone back and tested the same sample on v3.10.1).

Something of note is that this is only an issue when you have a long text gets printed to the terminal and then you resize the terminal smaller, and then resize it bigger. Another interesting behavior is that this ONLY occurs if you resize both rows AND columns, if you simply resize columns, without resizing rows, it does not crash the render (simply resizing rows also does not crash).

I would imagine it's probably something introduced by text-wrap feature, but I'm not too sure.

Thanks in advance to anyone looking into this!

Code snippet to play with: https://codesandbox.io/s/4jnl8qxxn4

typbug

All 5 comments

My guess is that ybase is being set based on _rows, instead of newRows which will cause it to have an invalid value when newRows is larger.

Also running into this issue. [UPDATED] na, actually mine is a little different. But it is on resize.

screen shot 2019-02-05 at 10 05 19 am

I downgraded to 3.10.0 and that fixed the issue. Will revisit this issue after this bug is addressed as it might affect the issue I was facing.

Reduced repro in demo:

  1. Run in console: term.resize(40,40)
  2. Paste console core fd full mqueue null ptmx pts random stderr stdin stdout tty urandom zero and press enter
  3. Run in console: term.resize(100,100)
  4. Run in console: term.resize(200,200)

This throws because lines.length === 198 (not 200)

Somewhat similar error which I didn't yet have success reproducing:

Uncaught TypeError: Cannot read property 'copyCellsFrom' of undefined
    at Buffer._reflowSmaller (D:\Dokumente\Projekte\Juno\atom-ink\node_modules\xterm\lib\Buffer.js:250:45)
    at Buffer._reflow (D:\Dokumente\Projekte\Juno\atom-ink\node_modules\xterm\lib\Buffer.js:170:18)
    at Buffer.resize (D:\Dokumente\Projekte\Juno\atom-ink\node_modules\xterm\lib\Buffer.js:152:18)
    at BufferSet.resize (D:\Dokumente\Projekte\Juno\atom-ink\node_modules\xterm\lib\BufferSet.js:78:22)
    at Terminal.resize (D:\Dokumente\Projekte\Juno\atom-ink\node_modules\xterm\lib\Terminal.js:1096:22)
    at Terminal.resize (D:\Dokumente\Projekte\Juno\atom-ink\node_modules\xterm\lib\public\Terminal.js:53:20)

@Tyriar Thank you for all your hard work!
I tested https://github.com/Microsoft/xterm.js/commit/88d424fed78ce1c918f4e0a131f207314c88a976 and it seems to have resolved the bug. I know #1930 needs to be merged in first before this fix can go in, any thoughts on if that could possibly happen this week?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

parisk picture parisk  路  3Comments

zhangjie2012 picture zhangjie2012  路  3Comments

Tyriar picture Tyriar  路  4Comments

LB-J picture LB-J  路  3Comments

jerch picture jerch  路  3Comments