@melmoth assuming that dynamic supervisor child is a GenServer which has default restart_strategy of permanent and if supervisor fails to start the child in max_attempts, it would lead to restart of supervisor which could be happening.
As you already mentioned, errors are being sorted and reduced so above should not happen frequently but you can try using use GenServer, restart: :transient
Or use restart: :temporary if that suits though I doubt
Actually, something I haven’t understood was that the max_attempts counter / time unit is set on the whole dynamic supervisor and not atomically per child. As several Child could fail at the same time, the counter would clearly be reached. So definitely I was missing something, stupid me !
The solution I came to, as the child creation depends on another process ChildMgr, is to monitor the dynamic supervisor from ChildMgr so that each Child is re-created on dyn supervisor restart. See the fix branch
I like the your solution @dimitarvp, it looks more straightforward than mine. The only question I could have is related to the child lifecycle, at some point I will have to terminate the child, I just need to make sure, the static supervisor can be terminated properly. I’ll definitely take it in consideration.
@pikender following that, your restart option is also a must have. The :permanent is not what I want in this context.