<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">This would still be incredibly useful.<div class=""><br class=""></div><div class="">Not having it throws a whole bunch of complexity every time a database or other type of potentially failing connection must be opened. Even more so if this process must start before other processes should start.</div><div class=""><br class=""></div><div class="">The current self() ! finish_startup recommendation drops all the startup ordering and failure recovery synchronisation on the programmer, and that is hard to get right.<br class=""><div class=""><br class=""></div><div class="">gen_server:init is such a natural place to put this synchronous opening logic. The supervisor can then take care of the synchronous start of the connection and managing dependent processes.</div><div class=""><br class=""></div><div class="">/Sean<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 10 May 2021, at 15:04, Richard Carlsson <<a href="mailto:carlsson.richard@gmail.com" class="">carlsson.richard@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">What happened at the time was that I met up with the OTP team and discussed it, and they eventually agreed that this was a good thing. However, it needed more work to be accepted (and I realized a couple of weaknesses in the implementation that I needed to address), but I never found time to do more work on it.<div class=""><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><br class=""> /Richard</div></div><br class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den sön 2 maj 2021 kl 21:01 skrev Nicolas Martyanoff <<a href="mailto:khaelin@gmail.com" class="">khaelin@gmail.com</a>>:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br class="">
Hi,<br class="">
<br class="">
I originally posted this email on erlang-patches, but I just realized<br class="">
most developers are on erlang-questions instead. I believe this could be<br class="">
of interest.<br class="">
<br class="">
<br class="">
Nine years ago, an interesting patch [1] was submitted by Richard Carlsson<br class="">
allowing to delay the re-creation of failed children in supervisors.<br class="">
<br class="">
After a quick discussions, the official answer was that the OTP team<br class="">
would discuss about it [2]. There is no further message on the mailing<br class="">
list.<br class="">
<br class="">
Was there an official response ?<br class="">
<br class="">
I have various supervisors whose children handle network connections.<br class="">
When something goes wrong with the connection, children die and are<br class="">
immediately restarted. Most of the times, errors are transient (remote<br class="">
server restarting, temporary network issue, etc.), but retrying without<br class="">
any delay is pretty much guaranteed to fail again. And of course after a<br class="">
few retries, the application dies which is unacceptable.<br class="">
<br class="">
This kind of behaviour is a huge problem: it fills logs with multiple<br class="">
copies of identical errors and causes a system failure.<br class="">
<br class="">
In general, if I could, I would use restart delays with exponential<br class="">
backoff everywhere because in practice, restarting immediately is almost<br class="">
never the right approach: code errors do not disappear when restarting<br class="">
so they are going to get triggered again immediately, and external errors<br class="">
are not magically fixed by retrying without any delay.<br class="">
<br class="">
Is there still interest for this patch ?<br class="">
<br class="">
[1] <a href="https://erlang.org/pipermail/erlang-patches/2012-January/002575.html" rel="noreferrer" target="_blank" class="">https://erlang.org/pipermail/erlang-patches/2012-January/002575.html</a><br class="">
[2] <a href="https://erlang.org/pipermail/erlang-patches/2012-January/002597.html" rel="noreferrer" target="_blank" class="">https://erlang.org/pipermail/erlang-patches/2012-January/002597.html</a><br class="">
<br class="">
-- <br class="">
Nicolas Martyanoff<br class="">
<a href="http://snowsyn.net/" rel="noreferrer" target="_blank" class="">http://snowsyn.net</a><br class="">
<a href="mailto:khaelin@gmail.com" target="_blank" class="">khaelin@gmail.com</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></div></body></html>