Bug 161298 - Can not log out after updating autofs
Can not log out after updating autofs
Status: CLOSED NEXTRELEASE
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: autofs (Show other bugs)
3.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeffrey Moyer
Brock Organ
:
Depends On:
Blocks: 190430
  Show dependency treegraph
 
Reported: 2005-06-22 00:02 EDT by John Newbigin
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-01-17 14:25:10 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Change setpgrp to setsid in become_daemon function (1.25 KB, patch)
2006-05-09 00:16 EDT, Ian Kent
no flags Details | Diff
Change setpgrp to setsid in become_daemon function (1.25 KB, patch)
2006-05-09 00:16 EDT, Ian Kent
no flags Details | Diff
Close fd's 0-255 in become_daemon (485 bytes, patch)
2006-05-09 14:23 EDT, Jeffrey Moyer
no flags Details | Diff

  None (edit)
Description John Newbigin 2005-06-22 00:02:46 EDT
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 Jeffrey Moyer 2005-06-27 15:35:13 EDT
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 00:22:28 EST
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-11 23:49:51 EDT
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 Jeffrey Moyer 2006-05-08 18:45:28 EDT
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 Jeffrey Moyer 2006-05-08 19:53:43 EDT
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 00:05:05 EDT
(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 00:16:00 EDT
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 00:16:28 EDT
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 Jeffrey Moyer 2006-05-09 14:22:26 EDT
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 Jeffrey Moyer 2006-05-09 14:23:08 EDT
Created attachment 128804 [details]
Close fd's 0-255 in become_daemon
Comment 12 Jeffrey Moyer 2007-01-17 14:25:10 EST
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.

Note You need to log in before you can comment on or make changes to this bug.