Bug 61371

Summary: /sbin/service qwerks
Product: [Retired] Red Hat Linux Reporter: Christopher McCrory <chrismcc>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: rvokal, shishz
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-03-21 04:00:47 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 Christopher McCrory 2002-03-18 18:44:59 UTC
Description of Problem:

Differing behavour with /sbin/service

Version-Release number of selected component (if applicable):
6.43-1 to current rawhide

How Reproducible:


Steps to Reproduce:
1. boot system
2. restart service with /sbin/service
3. 

Actual Results:
extra environment variables
and
possibly extra file handles

Expected Results:
clean environment
clean exit

Additional Information:
	
When the system boots it does the sysv init thing starting various daemons
At this point the environment is the same every time

but if I restart a service, the daemon can inherit my environment
this is easy to see with apache and php by running phpinfo() in a web page

on a freshly booted machine the environment is pretty clean.  After I restart
apache, the environment has things like:

QTDIR=/usr/lib/qt-2.3.1
LESSOPEN=|/usr/bin/lesspipe.sh %s
KDEDIR=/usr
LS_COLORS=<snip>
LANG=en_US
DISPLAY=localhost:11.0
etc.

Other programs like ucd-snmp keep local file handles and/or stderr open.  This
is easy to see via ssh.  "ssh server ; /sbin/service snmpd restart".  Your
connection will hang while ssh waits for stderr to close.  In the case of snmpd
it keeps a filehandle for my home directory

[chrismcc@philippe chrismcc]$ sudo /usr/sbin/lsof | grep snmp
snmpd     22946     root  cwd    DIR        8,3    4096    1466108 /home/chrismcc
snmpd     22946     root  rtd    DIR        8,3    4096          2 /
snmpd     22946     root  txt    REG        8,3   18028     374747 /usr/sbin/snmpd
...
snmpd     22946     root    0u   CHR      136,0                  2 /dev/pts/0

after killing my xterm

snmpd     22946     root    0u   CHR      136,0                  2 /dev/pts/0
(deleted)


Besides hanging ssh this can also cause problems with mounts.  i.e. if /home was
NFS mounted, you couldn't unmount it because it is 'busy'.  The same goes for
cdroms.  cd /mnt/cdrom ; rpm -ivh foo.rpm ; /sbin/service foo start ; cd / ;
umount /mnt/cdrom"  umount will not work because foo holds a file handle in
/mnt/cdrom


<disclaimer>
I'm not a programmer, I'm a sysadmin
</disclaimer>  


It seems it should be fairly easy to add this to /sbin/service

Comment 1 Bill Nottingham 2002-04-10 06:05:01 UTC
Fixed in 6.62-1.