contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.32k stars 101 forks source link

Crash: Cursor (63, 0) does not match clamp to screen (63, 56). #1444

Closed herrhotzenplotz closed 5 months ago

herrhotzenplotz commented 5 months ago

Short overview

I am currently seeing repeated crashes of contour:

===============================================================================================================================================================================================================================================
Cursor (63, 0) does not match clamp to screen (63, 56).
===============================================================================================================================================================================================================================================
Rendered screen at the time of failure
main page size       : 239x64
history line count   : 1000 (max 1000)
cursor position      : (63, 0)
vertical margins     : 0..63
horizontal margins   : 0..238
main page lines: scrollback cur 1000 max 1000, main page lines 64, used lines 1064, zero index 412
===============================================================================================================================================================================================================================================
<snip>
Image pool:
global image stats: 0 instances, 0 raster, 0 fragments
=============================================================
Hashtale: ImagePool name-to-image mappings
-------------------------------------------------------------
hashslot collisions : 0 (0%)
stats               : 0 hits, 0 misses, 0 evictions, 0% hit rate
hash table capacity : 1024 (0% utilization)
entry count         : 0
entry capacity      : 100 (0% utilization)
-------------------------------------------------------------
===============================================================================================================================================================================================================================================
Abort trap (core dumped)
$

Again, this is FreeBSD 14.0-RELEASE-p4 amd64 with FreeBSD clang 16 and Qt 6. The entire thing is running in a pure Wayland environment.

Reproduce

The issue seems to be quickly reproducible by producing output to the terminal and moving the mouse at the same time.

I did this by running: while :; do ls -lapho; done and then moving the mouse. Contour then crashes within milliseconds.

Logs / Debugger trace

See log at https://gist.githubusercontent.com/herrhotzenplotz/4695175147c1b77c4b6f09aee38e98c5/raw/0a661996166c9dffb7322eee0478a25c5af27be2/log If you wish that I re-run the same thing again with fancy debug options, please let me know. :-)

christianparpart commented 5 months ago

Oh, this is a very rare occasion. Many thanks for the report. 🤔 ...

herrhotzenplotz commented 5 months ago

Actually, it wasn't that rare. I was seeing exactly this crash at least 3 times within one hour of using kakoune in contour making it pretty much too unreliable to use.

Yaraslaut commented 5 months ago

I also encounter crashes from time to time, but not that often, and was not able to find ways to reliably repro this, lets hope this is it :)

herrhotzenplotz commented 5 months ago

I just got a crash from inside kakoune: https://gist.githubusercontent.com/herrhotzenplotz/4695175147c1b77c4b6f09aee38e98c5/raw/92a5c34b7eaf6909cf9646da77c3caa862276c87/log2

It indeed seems to be the same assertion tripping.

christianparpart commented 5 months ago

@herrhotzenplotz I cannot reproduce it, but I am pretty sure I've found something that must have caused this. Would you please mind testing the fix (#1450)?