bugGNU Screen - Bugs: bug #52545, vbell doesn't work, plus multiple...


bug #52545: vbell doesn't work, plus multiple bells cause a long lockup

Submitter:  Egmont Koblinger <egmont>
Submitted:  Tue 28 Nov 2017 10:55:50 AM UTC
Category:  Crash/Freeze/Infloop Severity:  3 - Normal
Priority:  * 5 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Release:  Cur Dev Sources
Fixed Release:  None Planned Release:  None
Work Required:  None
* Mandatory Fields

Add a New Comment Rich Markup

Tue 28 Nov 2017 10:55:50 AM UTC, original submission:  

With "vbell on" in screenrc, emit a hundred BELs in a row:

for i in {1..100}; do echo -ne '\a'; done

Notice that:
 - screen locks up and becomes unusable for 10 seconds,
 - and by the way, no visual bell is presented.

The lockup is, needless to say, pretty bad, and its duration increases proportionally to the number of BELs emitted (e.g. accidentally by cat'ing a binary file): a tenth of second for each BEL.

strace'ing reveals the following:

The first one or two BELs are handled separately, and then the rest in a single step. There's a

read(5, "\0\7\7\7\7\7\7\7 [...]

reading 98 or 99 BELs (the initial \0 is irrelevant, it's due to TIOCPKT), followed by 98 or 99

nanosleep({tv_sec=0, tv_nsec=100000000}, [...]

in a row which causes the 10 second delay, followed by

write(3, "\33[?5h\33[?5l\33[?5h\33[?5l\33[?5h\33[?5l [...]

toggling reverse video 98 or 99 times.

In xterm, the screen goes reverse maybe once or twice during processing these hundred BELs. In gnome-terminal it doesn't go reverse at all. I don't think it's feasible to expect that termial emulators will increase the duration of reverse video if they immediately encounter the sequence that turns it off.

I believe the whole point of the 0.1 second sleeps is that for a visual bell, the terminal should be set to reverse, then wait this much, and then restored to non-reverse video.

To address both issues, upon encountering a BEL the following should happen:
 - enable reverse video,
 - set an asynchronous timer for 0.1 seconds later,
 - continue processing input,
 - a subsequent BEL may or may not extend the timer, but there should be at most 1 timer at a time,
 - once the timer elapses, restore non-reverse video.

None of these issues happen with "vbell off", that is, no nanosleep() and no "\33[?5h\33[?5l" encountered in strace's log, and the for-loop finishes instantly.

Tested with 4.6.1 and git master.

Egmont Koblinger <egmont>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by egmont (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code