[erlang-questions] inets service startup
Ingela Anderton Andin
ingela@REDACTED
Wed Apr 11 15:05:34 CEST 2007
Serge Aleynikov wrote:
> Ingela Anderton Andin wrote:
>> Hi Serge!
>>
>> I do not know why that line was ever entered, and it was a bad idea
>> not to remove it altogether.
>> The httpd_sup supervisor is a one_for_one supervisor which means that
>> if there is a problem
>> with one child it should not affect the other children. It is
>> possible to start several HTTP-servers
>> and a configuration error in one of them should not have a bearing on
>> the others. Maybe the
>> error could be reported differently to be more "user friendly".
>
> I think it all depends on how critical that httpd service is in the
> process interdependency. If you have an application that cannot live
> without an HTTP server, the current implementation doesn't allow for
> intercepting a service startup problem (say due to a bad configuration
> option in the HTTP config file) and reacting appropriately (perhaps by
> aborting the boot process).
>
> The workaround I found was not to specify the HTTPD service in the
> inets environment options, but rather introduce an environment option
> {httpd_config_file, Filename::string()} in a custom application that
> would manage addition/removal of a child HTTPD process to/from the
> inets' supervisor.
>
> While this solution works, this way of error handling doesn't seem
> appealing to me. It looks that it would be nicer if INETS would offer
> some sort of customization of action of what to do on httpd service
> startup problems.
Thank you for your input.
That would be possible. We will take this under consideration when
constructing the new API.
> Below is the code describing this workaround. One other issue with
> this approach is that if there are other httpd services started by
> inets though its own environment options, if we want to stop the httpd
> instance managed by our custom app, there doesn't seem to be an easy
> way of figuring out which httpd service to stop. Perhaps returning
> httpd service's name {httpd_instance_sup, Addr, Port} by the
> httpd_sup:start_child/1 function would help.
>
There is no easy way, that is one of the points that will be improved in
a future release of intes.
Regards Ingela - OTP team
More information about the erlang-questions
mailing list