Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 3 product line. The current stable release is 3.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 161298

Summary: Can not log out after updating autofs
Product: Red Hat Enterprise Linux 3 Reporter: John Newbigin <jn>
Component: autofsAssignee: Jeff Moyer <jmoyer>
Status: CLOSED NEXTRELEASE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: ikent
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-01-17 19:25:10 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:
Bug Depends On:    
Bug Blocks: 190430    
Attachments:
Description Flags
Change setpgrp to setsid in become_daemon function
none
Change setpgrp to setsid in become_daemon function
none
Close fd's 0-255 in become_daemon none

Description John Newbigin 2005-06-22 04:02:46 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050319

Description of problem:
After updating autofs via ssh, when you log out of ssh the channel is keps open and the session will not dissconnect (requires a ~&)

Version-Release number of selected component (if applicable):
autofs-4.1.3-130

How reproducible:
Always

Steps to Reproduce:
1. ssh into machine using autofs
2. rpm -U http://some/path/autofs-4.1.3-130.i386.rpm
3. exit
  

Actual Results:  ssh session does not exit.

Additional info:

This is a long standing issue.

Comment 1 Jeff Moyer 2005-06-27 19:35:13 UTC
I'll try to reproduce this.  Note that I do this sort of thing all of the time,
and have not experienced this issue.

Comment 2 John Newbigin 2005-11-14 05:22:28 UTC
This is still a problem when installing U6.  After the update, the automount
daemon is running with a terminal instead of as a daemon.

# ps ax | grep automount
 2615 ?        S      1:08 /usr/sbin/automount --timeout=5 /misc program
/root/miscmount.sh

# rpm -U autofs-4.1.3-154.i386.rpm

# ps ax | grep automount
 1804 pts/0    S      0:00 /usr/sbin/automount --timeout=5 /misc program
/root/miscmount.sh


Comment 3 John Newbigin 2006-04-12 03:49:51 UTC
Still a problem in U7
ps -ef show that automount running with a controlling terminal
root     23119     1  0 13:48 pts/1    00:00:00 /usr/sbin/automount --timeout=60
/home/students/accounts program /usr
After logging out from ssh I have to use ~& to background the connection.
Logging back in shows that automount is now running without a terminal
root     23119     1  0 13:48 ?        00:00:00 /usr/sbin/automount --timeout=60
/home/students/accounts program /usr


Comment 4 Jeff Moyer 2006-05-08 22:45:28 UTC
It looks to me like the become_daemon code in autofs should call setsid() to
clear the controlling tty.

Ian, and particular reason this isn't done?

Comment 5 Jeff Moyer 2006-05-08 23:53:43 UTC
Ian, nevermind the above.  It seems we are keeping some file descriptors open. 
I know that my daemon-exit-wait patch left one open, I'm pouring through the
rest of the code to find other culprits.

Comment 6 Ian Kent 2006-05-09 04:05:05 UTC
(In reply to comment #5)
> Ian, nevermind the above.  It seems we are keeping some file descriptors open. 
> I know that my daemon-exit-wait patch left one open, I'm pouring through the
> rest of the code to find other culprits.

There's patch around for 4.1.4 for that.

I didn't notice until it was reported by the Debian folks.
Many moons ago we would do a double fork to do this but
there's only a single fork in become_daemon.

I'll have a look around for the patch.

Ian




Comment 7 Ian Kent 2006-05-09 04:16:00 UTC
Created attachment 128769 [details]
Change setpgrp to setsid in become_daemon function

We should do this as well as hunt for the open file
handles. The become_daemon function is not incorrect.

Comment 8 Ian Kent 2006-05-09 04:16:28 UTC
Created attachment 128770 [details]
Change setpgrp to setsid in become_daemon function

We should do this as well as hunt for the open file
handles. The become_daemon function is incorrect.

Comment 9 Jeff Moyer 2006-05-09 18:22:26 UTC
OK, it turns out that this only happens from upgrading autofs, which points to
RPM.  RPM doesn't seem to set the close-on-exec bit for the file descriptors it
opens, and so those get inherited by automount.

I've modified the daemon to close fd's 0-255, and this appears to fix the
problem.  Note that this is the only change required, though I'll likely include
the setsid patch as well.  I'll follow up with a patch in a moment.

The RPM bug I filed is bz #191196.

Comment 10 Jeff Moyer 2006-05-09 18:23:08 UTC
Created attachment 128804 [details]
Close fd's 0-255 in become_daemon

Comment 12 Jeff Moyer 2007-01-17 19:25:10 UTC
Given that this particular issue is fixed in an RPM erratum, and given that RHEL
3 is only receiving critical updates, I'm closing this bug.  The issue is
addressed in RHEL 4.