[Freeipa-devel] [PATCH] 324 Add fallback for httpd restarts

Rob Crittenden rcritten at redhat.com
Fri Oct 19 18:11:03 UTC 2012


Martin Kosek wrote:
> On 10/18/2012 04:36 PM, Rob Crittenden wrote:
>> Martin Kosek wrote:
>>> On 10/18/2012 02:47 PM, Rob Crittenden wrote:
>>>> Martin Kosek wrote:
>>>>> Attaching a script I used to reproduce the issue on machine with sysV (RHEL
>>>>> 6.4
>>>>> in my case). With the patch applied, httpd restarts correctly fallback-ed.
>>>>>
>>>>> If you think that the wait is not enough, I can add a more complicated
>>>>> procedure, like this one:
>>>>>
>>>>> wait_time = 5
>>>>> retries = 3
>>>>>
>>>>> for x in xrange(retries):
>>>>>        try:
>>>>>           sleep(wait_time)
>>>>>           http.stop()
>>>>>           sleep(wait_time)
>>>>>           http.start()
>>>>>        except CalledProcessError:
>>>>>           wait_time = wait_time * 2
>>>>>           continue
>>>>>        break
>>>>>
>>>>>
>>>>> ----
>>>>>
>>>>> httpd init script on sysV based platforms cannot guarantee that two
>>>>> consecutive httpd service restarts succeed when run in a small
>>>>> time distance.
>>>>>
>>>>> Add fallback procedure that adds additional waiting time after such
>>>>> failed restart attempt, and then try to stop and start the service
>>>>> again.
>>>>>
>>>>> https://fedorahosted.org/freeipa/ticket/2965
>>>>
>>>>
>>>> Should we attempt to retrieve a file to ensure that the service is up? The
>>>> ipa.crt would be a candidate for this.
>>>>
>>>> rob
>>>
>>> Hm, this looks over-engineered from my POV. We already check that ports are
>>> open, right?
>>
>> Well, this is assuming that sysV is going to return an error when httpd doesn't
>> start. It should at least call service status to make sure the service is
>> operational.
>>
>> rob
>>
>
> Actually, we generally already do that as a part of start() process, you will
> see it when running my test script:
>
> DEBUG: stderr=
> DEBUG: args=/sbin/service httpd restart
> DEBUG: stdout=Stopping httpd:                              [FAILED]
> Starting httpd:                                            [FAILED]
>
> DEBUG: stderr=(98)Address already in use: make_sock: could not bind to address
> [::]:80
> (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
> no listening sockets available, shutting down
> Unable to open logs
>
> DEBUG: httpd restart failed, try to stop&start again
> DEBUG: args=/sbin/service httpd stop
> DEBUG: stdout=Stopping httpd:                              [  OK  ]
>
> DEBUG: stderr=
> DEBUG: args=/sbin/service httpd start
> DEBUG: stdout=Starting httpd:                              [  OK  ]
>
> DEBUG: stderr=
> DEBUG: args=/sbin/service httpd status          <<<<<<<<<<
> DEBUG: stdout=httpd dead but subsys locked
>
> But I just realized, that my change in httpinstance.py is redundant, it uses
> platform service to do the restart which has the fallback already, i.e.
> modification there is enough. Updated patch attached.
>
> Martin
>

ack, pushed to master and ipa-3-0




More information about the Freeipa-devel mailing list