<div>I have created a gen_fsm(module: test_service), which is started as a temporary child of supervisor(module: test_service_sup).</div><div>Since the instance of test_service can be created dynamically, I use the simple_one_for_one strategy.</div>
<div><br></div><div>However, when the FSM(test_service) exit abnormally, we can not get the start parameters for the FSM in SUPERVISOR REPORT:</div><div>2012-10-12 14:15:28 =SUPERVISOR REPORT====</div><div>     Supervisor: {local,test_service_sup}</div>
<div>     Context:    child_terminated</div><div>     Reason:     timeout</div><div>     Offender:   [{pid,<0.2250.0>},{name,test_service},{mfargs,{test_service,start_link,undefined}},{restart_type,temporary},{shutdown,infinity},{child_type,worker}]</div>
<div><br></div><div>So it's hard for us to figure out which test_service instance has failed.  Is there any better method ?</div><div><br></div><div>Thanks in advance!</div><div><br></div><div>FYI:</div><div>1. If test_service is registered as a  permanent instead of temporary child of test_service_sup, then when it exits abnormally, the UPERVISOR REPORT will include its start parameters.</div>
<div><br></div><div>2. This is the code:</div><div>1)</div><div>-module(test_service).</div><div>-behaviour(gen_fsm).</div><div><br></div><div>start_link(Parameter) -></div><div><span class="Apple-tab-span" style="white-space:pre">      </span>gen_fsm:start_link(?MODULE, [Parameter], []).</div>
<div><br></div><div>init([Parameter]) -></div><div>  ...</div><div>  {ok, trying, state}.</div><div><br></div><div>2)</div><div>-module(test_service_sup).</div><div>start_child(Parameter) -></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>supervisor:start_child(?SERVER, [Parameter]).</div>
<div><br></div><div>init([]) -></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>TestServiceSpec = {test_service,</div><div><span class="Apple-tab-span" style="white-space:pre">                                                     </span>        {test_service, start_link, []},</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                      </span>        temporary,</div><div><span class="Apple-tab-span" style="white-space:pre">                                                   </span>        infinity,</div><div><span class="Apple-tab-span" style="white-space:pre">                                                    </span>        worker,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                      </span>        [test_service]},<span class="Apple-tab-span" style="white-space:pre">                                                    </span>  </div><div>    {ok, { {simple_one_for_one, 0, 1}, [TestServiceSpec]} }.</div>