bugGNU Screen - Bugs: bug #58132, screen -r hangs terminal

 
 

bug #58132: screen -r hangs terminal

Submitter:  None
Submitted:  Tue 07 Apr 2020 03:17:07 AM UTC
   
 
Category:  Crash/Freeze/Infloop Severity:  3 - Normal
Priority:  * 5 - Normal Status:  Need Investigation
Privacy:  Public Assigned to:  None
Open/Closed:  Open Release:  None
Fixed Release:  None Planned Release:  4.8.0
Work Required:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 16 Apr 2025 01:32:13 AM UTC, comment #6: 

Work Around: change st.c termname from default st-256color to stterm-256color.  (eg. ls -al /usr/share/terminfo/s/st* )

The /usr/share/terminfo/s/stterm-256color is provided by the ncurses-term-6.5_2 package; separate of suckless st package.

st.c
-- char *termname = "st-256color";
++ char *termname = "stterm-256color";

Detaching and reconnecting to GNU Screen now works.  For color script testing, 256colors2.pl works; 24-bit-color.sh only works within st natively, not within GNU Screen; color-spaces.pl works within st natively, only partially within GNU Screen and printing black/white cubes for the later cubes.

rogerx.oss <rogerxoss>
Tue 15 Apr 2025 10:41:19 PM UTC, comment #5: 

screen-5.0.0_2  (term screen-256color as user, and as root no screenrc file.)
st-0.9.2_1 (disabled all patches, native code compiled.)

Running into this bug as well, the core dump seems to be generated by the (GNU) screen program during reattaching to a detached session.  (eg. debug symbols are readable/printable with "gdb /usr/bin/screen ./core.15528" rather than specifying the st program)

Oddly, I have two dissimilar core dump files, seconds apart posted below, however, seems very similar screen.c 1107 line number locations.  But on the flip, sometimes I get an immediate core dump upon "screen -RD" while most times I get an endless hard hang when executing "screen -RD".

Setting $TERM to xterm-256color from within st terminal works around this reattach bug, however with an incompatible terminfo file when using VIM (eg. tput clear).  And, likely using default 16 color also averts this hard hang and/or segfault bug. (eg. $TERM=st)

Bottom two core dump backtraces were executed using no $HOME/.screenrc as root.

# gdb /usr/bin/screen ./core.15528
...snip...
Reading symbols from /usr/bin/screen...
Reading symbols from /usr/lib/debug/usr/bin/screen-5.0.0...
[New LWP 15528]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
Core was generated by `/usr/bin/screen -RD'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44

warning: 44     ./nptl/pthread_kill.c: No such file or directory
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x00007f11a9ff924f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:89
#2  0x00007f11a9fa9fe2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f11a9f92efc in __GI_abort () at ./stdlib/abort.c:73
#4  0x0000559698158a35 in CoreDump (sigsig=<optimized out>) at ./screen.c:1182
#5  <signal handler called>
#6  0x00007f11aa1a89f9 in _nc_find_type_entry () from /usr/lib/libncursesw.so.6
#7  0x00007f11aa1acbb1 in tgetflag_sp () from /usr/lib/libncursesw.so.6
#8  0x00005596981a2528 in e_tgetflag (cap=0x5596981ae7ab "xn") at ./termcap.c:1178
#9  InitTermcap (width=0, height=0) at ./termcap.c:115
#10 0x000055969819d301 in FinishAttach (m=m@entry=0x5596981d0fc0 <m>) at ./socket.c:981
#11 0x000055969819df01 in ReceiveMsg () at ./socket.c:841
#12 0x000055969819a456 in sched () at ./sched.c:200
#13 0x000055969815a9ba in main (argc=0, argv=<optimized out>) at ./screen.c:1107



# gdb /usr/bin/screen ./core.15537
...
Reading symbols from /usr/bin/screen...
Reading symbols from /usr/lib/debug/usr/bin/screen-5.0.0...
[New LWP 15537]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
Core was generated by `/usr/bin/screen -RD'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44

warning: 44     ./nptl/pthread_kill.c: No such file or directory
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x00007f05dede024f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:89
#2  0x00007f05ded90fe2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f05ded79efc in __GI_abort () at ./stdlib/abort.c:73
#4  0x000055bde4353a35 in CoreDump (sigsig=<optimized out>) at ./screen.c:1182
#5  <signal handler called>
#6  __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:994
#7  0x000055bde4358a27 in FindUserPtr (name=name@entry=0x55bde43ccfc8 <m+4104> "root") at ./acls.c:122
#8  0x000055bde4367667 in MakeDisplay (uname=uname@entry=0x55bde43ccfc8 <m+4104> "root",
    utty=utty@entry=0x55bde43cbfc8 <m+8> "/dev/pts/14", term=term@entry=0x55bde43cd0f8 <m+4408> "st-256color", fd=fd@entry=7,
    pid=pid@entry=15545, Mode=Mode@entry=0x7ffc0b9fb5e0) at ./display.c:176
#9  0x000055bde4396bb0 in CreateTempDisplay (recvfd=recvfd@entry=7, win=win@entry=0x0, m=<optimized out>) at ./socket.c:671
#10 0x000055bde4398b59 in ReceiveMsg () at ./socket.c:836
#11 0x000055bde4395456 in sched () at ./sched.c:200
#12 0x000055bde43559ba in main (argc=0, argv=<optimized out>) at ./screen.c:1107

rogerx.oss <rogerxoss>
Tue 14 Feb 2023 09:10:18 AM UTC, comment #4: 

I've noted, that the problem depends on the terminal emulator.
I'm using https://st.suckless.org/

$ echo $TERM
st-256color

Changing the TERM value solves the issue
$ export TERM=xterm-256color

Aleksandr Kolychev <sids>
Sun 22 Jan 2023 11:15:39 PM UTC, comment #3: 

I tried the current screen-v4 sources again on Manjaro Linux x86_64.
It works for me...
If you can provide some more details we can try to debug it together. In that case please reopen this report or to create the new one.

Alexander Naumov <anaumov>
Group administrator
Thu 30 Apr 2020 10:12:48 PM UTC, comment #2: 

I don't know whether I have the same problem or not.
My terminal doesn't hang with screen -r, but it cannot reattach to any session with the following message: [screen caught signal 11.]

I have a fresh Archlinux installed with the latest updates.

$ screen -v
Screen version 4.08.00 (GNU) 05-Feb-20

$ screen -ls
There is a screen on:
        54052.pts-0.sidshome    (Detached)
1 Socket in /home/sids/.screen.

$ screen -r

[screen caught signal 11.]

$ screen -ls
There is a screen on:
        54052.pts-0.sidshome    (Dead ???)
Remove dead screens with 'screen -wipe'.
1 Socket in /home/sids/.screen.


I tried to install git-version 4.8.0 from branch screen-v4 at 30c9a2a6c190647e35d1ce7b4758de9081f06d10, same behavior.

Problem disappears with version 4.7.0

The package is built under Arch with the following commands:

./autogen.sh
./configure \
        --prefix=/usr \
        --mandir=/usr/share/man \
        --infodir=/usr/share/info \
        --enable-pam \
        --enable-utmp \
        --enable-telnet \
        --enable-socket-dir \
        --with-system_screenrc="/etc/screenrc" \
        --with-pty-mode="0622" \
        --with-pty-group="5" \
        --with-pty-rofs="yes"

make


Aleksandr Kolychev <sids>
Mon 27 Apr 2020 03:44:52 PM UTC, comment #1: 

I tested screen 4.8.0 (checked from git) right now on openSUSE. It works.
If there is just one screen detached session, 'screen -r' will use this one, and if you have more then one:


> screen -v
Screen version 4.08.00 (GNU) 05-Feb-20

> screen -ls
There are screens on:
        28297.pts-0.ThinkPad    (Detached)
        27857.pts-0.ThinkPad    (Detached)
2 Sockets in /tmp/screens/S-alex.

> screen -r
There are several suitable screens on:
        28297.pts-0.ThinkPad    (Detached)
        27857.pts-0.ThinkPad    (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.


Can you try git-version 4.8.0 (branch 'screen-4') please?
Are there any patches used with screen packages on Arch GNU/Linux?

Alexander Naumov <anaumov>
Group administrator
Tue 07 Apr 2020 03:17:07 AM UTC, original submission:  

On screen version 4.8.0, attempting to reattach to a detached session with screen -r hangs. The session is not displayed, and the only way to get out is to kill the terminal. Processes under the session continue running, but there is no way to reattach to the session itself.

Encountered on the current version of Arch GNU/Linux both with the distribution provided package of screen 4.8.0 and the source 4.8.0. Problem is not present source build of 4.7.0.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #50173:  screen.dump added by None (996B - application/octet-stream - I get the same behaviour as comment #2. I tried getting a bt with gdb but somehow having to invoke screen a second time messes this up. I attach the output from coredumpctl, hoping that it is useful)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rogerxoss (Posted a comment)
  • -email is unavailable- added by sids (Posted a comment)
  • -email is unavailable- added by anaumov (Posted a comment)
  •  

    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.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-08-10 anaumov StatusWorks For Me Need Investigation
        Open/ClosedClosed Open
    2023-01-22 anaumov StatusNeed Info Works For Me
        Open/ClosedOpen Closed
    2020-10-31 None Attached File- Added screen.dump, #50173
    2020-04-27 anaumov StatusNone Need Info

    Back to the top

    Powered by Savane 3.15-ef91.
    Corresponding source code