Bug 89653

Summary: When closing telnet, child processes are not killed
Product: [Retired] Red Hat Linux Reporter: Matthew Wygant <matthew_wygant>
Component: telnetAssignee: Harald Hoyer <harald>
Status: CLOSED DUPLICATE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: matthew_wygant
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-02-21 18:52:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matthew Wygant 2003-04-25 15:18:23 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020826

Description of problem:
When exiting the telnet session (by closing the terminal and NOT typing exit) if
there are any child processes running in the background, they become session
zombies and eat up 100% of the processor.  If exit is typed, this does not
occur, if SSH is used, this does not occur.  This occurs on a RH8 server as
well.  Cannot use SSH, customer base too large to retrain to type exit.  Tried
freshen install of telnet-server, got latest util-linux, did up2date on all
packages and problem still exists.  

Version-Release number of selected component (if applicable):
default version of telnet-server, updated util-linux-2.11z

How reproducible:
Always

Steps to Reproduce:
1.open telnet to a RH7.2 server
2.start jobs/processes
3.close terminal by closing terminal, not exit
4.run top to see CPU get eaten up 

Actual Results:  CPU goes to 100% within a few minutes.

Expected Results:  Child processes get SIGHUP and die a graceful death.

Additional info:

Comment 1 Harald Hoyer 2003-04-25 15:51:17 UTC
ok, here is the problem:
- telnetd exits
- kernel sends SIGHUP to terminal sessions leader
- login has forked itsself because of PAM
- the parent login process ignores SIGHUP
- the child login (now bash) does not get SIGHUP
--> login and bash stay alive after telnetd exists

problem is in util-linux-2.11n-5 login.c(1135):
    } else if (childPid) {
       /* parent - wait for child to finish, then cleanup session */
       /* ioctl(0, TIOCNOTTY, NULL); */
       signal(SIGHUP, SIG_IGN);
       signal(SIGINT, SIG_IGN);
       signal(SIGQUIT, SIG_IGN);
       signal(SIGTERM, SIG_IGN);

       wait(NULL);
       PAM_END;
       exit(0);
    }

solution:
- catch the signal and kill(childPid, SIGHUP)
- or make the child the session leader (setsid())

As per #54741, this is fixed in util-linux-2.11n-8



*** This bug has been marked as a duplicate of 59029 ***

Comment 2 Red Hat Bugzilla 2006-02-21 18:52:49 UTC
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.