Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1625607

Summary: agetty process consuming nearly 100% CPU after login on ttyS0
Product: Red Hat Enterprise Linux 7 Reporter: Guoshuai Sun <sunguoshuai>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: sunguoshuai
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-17 09:16:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Guoshuai Sun 2018-09-05 10:50:06 UTC
Description of problem:
agetty process consuming nearly 100% CPU after login on ttyS0

Version-Release number of selected component (if applicable):
util-linux-2.23.2-52.el7.x86_64

How reproducible:
Conditionally Reoccur

Steps to Reproduce:
1.In a rhel7.5 vm ,I add "console=ttyS0," in the grub.cfg :
# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-862.el7.x86_64 root=/dev/mapper/rhel-root ro crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet LANG=zh_CN.UTF-8 console=ttyS0,115200

2.execute this command: /sbin/agetty -L 115200 ttyS0 vt102

3.On the host, I execute "virsh console [vm-name]" to login on ttyS0

Actual results:

After I login in the system on ttyS0 , I find that agetty process consumes nearly 100% CPU always.

top - 18:47:08 up 18 min,  1 user,  load average: 1.00, 0.96, 0.71
Tasks: 111 total,   2 running, 109 sleeping,   0 stopped,   0 zombie
%Cpu(s): 14.9 us, 34.5 sy,  0.0 ni, 50.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.3 st
KiB Mem :  1833564 total,  1522712 free,   108552 used,   202300 buff/cache
KiB Swap:  2097148 total,  2097148 free,        0 used.  1552444 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1507 root      20   0  110464   1148    984 R  99.3  0.1  13:19.36 agetty
 1538 root      20   0  161984   2276   1556 R   0.7  0.1   0:00.05 top
    1 root      20   0  127948   6568   4144 S   0.0  0.4   0:01.86 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kthreadd
    3 root      20   0       0      0      0 S   0.0  0.0   0:00.03 ksoftirqd/0
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H

---In addition,when I strace the process,I find that read() has been called constantly:
 
[root@localhost ~]# ps -ef |grep agetty
root       678     1  0 18:28 tty1     00:00:00 /sbin/agetty --noclear tty1 linux
root      1507  1480 55 18:33 pts/0    00:00:53 /sbin/agetty -L 115200 ttyS0 vt102
root      1517     1  0 18:34 ttyS0    00:00:00 /sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt220
root      1523  1480  0 18:34 pts/0    00:00:00 grep --color=auto agetty
[root@localhost ~]# strace -f -p 1507
read(0, "", 1)                          = 0
read(0, "", 1)                          = 0
read(0, "", 1)                          = 0
read(0, "", 1)                          = 0
read(0, "", 1)                          = 0
read(0, "", 1)                          = 0
...
 
read() is called in a very high frequency.

Expected results:
Process agetty should not consume so much CPU time always 

Additional info:
suse11.4  is OK , It's util-linux version is 2.19.1-6.72.1

Comment 2 Karel Zak 2018-09-06 08:02:27 UTC
> root      1507  1480 55 18:33 pts/0    00:00:53 /sbin/agetty -L 115200 ttyS0
                                ^^^^
It seems you're running agetty on already established session with another terminal, right? If yes, that it does not make sense. It has to be executed by init against the specified terminal.

And note that aggety is only waiting for users log-in. After your log-in it executes login(1) and it executes bash(1). It means after log-in there is no agetty process at all on the terminal. From your example it seems you have regular agetty (executed by init on ttyS0 and used for your log-in) and another agetty executed manually on the same tty.

Comment 3 Guoshuai Sun 2018-09-15 06:10:44 UTC
> It seems you're running agetty on already established session with another terminal, right? If yes, that it does not make sense. It has to be executed by init against the specified terminal.

Thank you! I already understand why.