Skip to content

use_pty: after killing an SSH connection some application are still running #367

@DispatchCode

Description

@DispatchCode

Few months ago we discovered a bug that can be reproduced using Defaults use_pty while connected to a machine using SSH.
The bug was "more" related, and here you can find the report: more: exit if POLLHUP or POLLERR on stdin is received.

Now we are facing - more or less - the same problem but with tail. In short, you can reproduce the issue doing:

  1. be sure to use Defaults use_pty (that is now the default)
  2. sudo su -
  3. tail -f /var/log/messages
  4. kill the SSH connection

You will see the tail still running after that. strace produced this output:

strace: Process 2051 attached
select(5, [4], NULL, NULL, NULL)        = 1 (in [4])
read(4, "\1\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0", 34) = 16
fstat(3, {st_mode=S_IFREG|0640, st_size=2031533, ...}) = 0
read(3, "2024-02-21T10:51:06.467247+01:00"..., 8192) = 215
write(1, "2024-02-21T10:51:06.467247+01:00"..., 215) = -1 EIO (Errore di input/output)
read(3, "", 8192)                       = 0
select(5, [4], NULL, NULL, NULL)        = 1 (in [4])
read(4, "\1\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0", 34) = 16
fstat(3, {st_mode=S_IFREG|0640, st_size=2031648, ...}) = 0
read(3, "2024-02-21T10:51:06.477515+01:00"..., 8192) = 115
write(1, "2024-02-21T10:51:06.477515+01:00"..., 115) = -1 EIO (Errore di input/output)
read(3, "", 8192)                       = 0

and it never ends. Basically tail keep reading from the file.

Considering that they are not the only tasks with a similar problem, can be this caused by sudo, specifically, the option use_pty ?

The use of KillUserProcesses=yes is not an option.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions