One critical problem has been identified. amfnd can correlate CLC CLI 
completion info with a wrong component.

In avnd_comp_clc_cmd_execute(), amfnd stores opaque data that it got from leap 
in the component structure:

        /* finally execute the command */
        rc = ncs_os_process_execute_timed(&cmd_info);

        /* Remove the env_set structure */
        for (i = 0; i < env_counter; i++) {
                free(env_set[i].name);
                free(env_set[i].value);
        }
        free(env_set);

        if (NCSCC_RC_SUCCESS != rc) {
        } else {
                TRACE_2("The CLC CLI command execution success");
                if (cmd_type == AVND_COMP_CLC_CMD_TYPE_AMSTART || cmd_type == 
AVND_COMP_CLC_CMD_TYPE_AMSTOP)
                        clc_info->am_cmd_exec_ctxt = cmd_info.o_exec_hdl;
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                else {
                        clc_info->cmd_exec_ctxt = cmd_info.o_exec_hdl;
                        m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, comp, 
AVND_CKPT_COMP_CMD_EXEC_CTXT);
                }
        }


As can be seen in sysf_exc_scr.c/add_new_req_pid_in_list() this opaque data is 
in fact a pointer to dynamically allocated memory.

avnd_comp_clc_resp() is a callback executed by a leap thread, the same opaque 
data as above is passed as parameters and copied and stored in an event an put 
into the amfnd mailbox.

As soon as the callback return, the opaque data is freed. See 
sysf_exc_scr.c/give_exec_mod_cb()

In avnd_evt_clc_resp_evh() amfnd does correlation between data received from 
the leap callback and data stored in components. Since the memory has been 
freed it can have be reused and now point to a different component.

smfnd is also a user of ncs_os_process_execute_timed() and does it the right 
way by storing a client handle in i_usr_hdl and using that instead.

The loop in avnd_evt_clc_resp_evh() traversing the comp db can be removed. Just 
reference the comp pointer directly. With a large number of components this is 
a also a great optimization!




---

** [tickets:#514] Amfnd: Component cleanup fail**

**Status:** accepted
**Created:** Mon Jul 22, 2013 08:15 AM UTC by hano
**Last Updated:** Mon Jul 22, 2013 10:49 AM UTC
**Owner:** hano

When amfnd is to run component cleanup script, the exec in the child process is 
not run and a timeout after 10 seconds is delivered to amfnd. Probably the 
child process "hangs" when closing file descriptors before exec. A patch that 
will use alarm in the child process is being tested.


---

Sent from sourceforge.net because [email protected] is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to