Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-105322

Hitting "F" (to follow changes) then closing abruptly the terminal leads to spinning on the CPU

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • rhel-9.8
    • rhel-9.6
    • less
    • Yes
    • Low
    • 1
    • rhel-jotnar
    • 0
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • BaseUtilsC Sprint CY25_01
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      This is a continuation of RHEL-105319.
      While on RHEL8 less polls the file every 1 second, on RHEL9 less starts spinning on the CPU, trying to read on the closed tty:

      ...
      13:15:16.715226 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000013>
      13:15:16.715271 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000013>
      13:15:16.715317 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000013>
      13:15:16.715363 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000014>
      13:15:16.715409 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000013>
      13:15:16.715453 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000013>
      13:15:16.715504 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000013>
      13:15:16.715549 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000013>
      13:15:16.715599 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000020>
      13:15:16.715651 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000013>
      13:15:16.715696 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000013>
      13:15:16.715746 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000013>
      13:15:16.715792 read(3</dev/pts/1>(deleted), "", 1) = 0 <0.000014>
      ...
      

      Additional note

      There is a second "regression": when hitting "F" to follow, less on RHEL9 takes a lot more CPU than on RHEL8, because it polls the file every 2ms, instead of 1s.
      IMHO the code should be reimplemented to rely on inotify instead of polling, similar to what tail -f does.

              jotnar-project Jötnar Project
              rhn-support-rmetrich Renaud Métrich
              Michal Hlavinka Michal Hlavinka
              Jötnar Project Jötnar Project
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated: