PacketFence - BTS - PacketFence 1.7
View Issue Details
0000327PacketFence 1.7public2008-05-28 14:592008-06-02 11:45
jsnapp 
user4 
normalminoralways
closedfixed 
 
 
0000327: httpd takes a while to stop which can prevent iptables.bak from being restored.
httpd takes a while to stop which can prevent iptables.bak from being restored.

I was able to recreate this consistently simply by running the following commands.

pfcmd httpd start
pfcmd httpd restart
pfcmd httpd stop

After the stop command runs the iptables.bak have not been restored which leaves iptables running with PF's config. This is because httpd was still running when the test for restore_iptables call was run.

Then if the "pfcmd httpd start" command is run PF's iptables entries are mistakenly backed up to iptables.bak causing even more confusion.

This problem also prevents the command "service packetfence restart" from successfully restarting httpd.
I've consistently found that it restarts all other PF processes except httpd which ends up in a stopped state.

IMHO, a sufficient fix only requires adding a "sleep" command immediately after any PF process is killed inside the "service_ctl" function in pf/lib/pf/services.pm.



--- services.pm.old 2008-05-28 14:36:50.000000000 -0400
+++ services.pm 2008-05-28 14:37:05.000000000 -0400
@@ -72,6 +72,7 @@
       open(STDERR,">/dev/null");
       #my @debug= system('pkill','-f',$exe);
       my @debug= system('pkill',$exe);
+ sleep 2;
       last CASE;
     };
     $action eq "restart" && do {
No tags attached.
related to 0000324closed user4 make sure pfmon (and all the processes) are really stoped before packetfence restarts 
Issue History
2008-05-28 14:59jsnappNew Issue
2008-05-28 23:08user4Relationship addedrelated to 0000324
2008-05-28 23:08user4Statusnew => assigned
2008-05-28 23:08user4Assigned To => user4
2008-05-30 21:54user4Note Added: 0000722
2008-05-30 21:56user4Statusassigned => closed
2008-05-30 21:56user4Note Added: 0000723
2008-05-30 21:56user4Resolutionopen => fixed
2008-06-02 11:43user4Statusclosed => feedback
2008-06-02 11:43user4Resolutionfixed => reopened
2008-06-02 11:43user4Note Added: 0000725
2008-06-02 11:43user4Note Added: 0000726
2008-06-02 11:45user4Statusfeedback => closed
2008-06-02 11:45user4Note Added: 0000728
2008-06-02 11:45user4Resolutionreopened => fixed

Notes
(0000722)
user4   
2008-05-30 21:54   
--- pf/lib/pf/services.pm 4f11b857233e40ae760e8c2bf1e07aec9b00b9be
+++ pf/lib/pf/services.pm 58ab7c51e15e3384b4997088ab0ed99c23caa02b
@@ -72,6 +72,13 @@ sub service_ctl {
       open(STDERR,">/dev/null");
       #my @debug= system('pkill','-f',$exe);
       my @debug= system('pkill',$exe);
+ my $maxWait = 10;
+ my $curWait = 0;
+ while (($curWait < $maxWait) && (service_ctl($exe) != 0)) {
+ pflogger("Waiting for $exe to stop");
+ sleep(2);
+ $curWait++;
+ }
       last CASE;
     };
     $action eq "restart" && do {
(0000723)
user4   
2008-05-30 21:56   
fixed in mtn revision a53f43a139ca5e80aa6b194d9554f8483fe1eb7e
(0000725)
user4   
2008-06-02 11:43   
the fix unfortunately contained a typo
(0000726)
user4   
2008-06-02 11:43   
#
# old_revision [a53f43a139ca5e80aa6b194d9554f8483fe1eb7e]
#
# patch "pf/lib/pf/services.pm"
# from [58ab7c51e15e3384b4997088ab0ed99c23caa02b]
# to [f3b2ad8f2a178ecf8716fa4c58244a3fb26b05c2]
#
============================================================
--- pf/lib/pf/services.pm 58ab7c51e15e3384b4997088ab0ed99c23caa02b
+++ pf/lib/pf/services.pm f3b2ad8f2a178ecf8716fa4c58244a3fb26b05c2
@@ -74,7 +74,7 @@ sub service_ctl {
       my @debug= system('pkill',$exe);
       my $maxWait = 10;
       my $curWait = 0;
- while (($curWait < $maxWait) && (service_ctl($exe) != 0)) {
+ while (($curWait < $maxWait) && (service_ctl($exe,"status") != 0)) {
         pflogger("Waiting for $exe to stop");
         sleep(2);
         $curWait++;
(0000728)
user4   
2008-06-02 11:45   
fixed in mtn revision fd26871f92e6b9227e9bbdce89e9c53ea809e547