Hi, sir:
I use mtcp to checkpoint/restart the testmtcp,
But some times the mtcp_restart will core dump.
I found that the function sigaction() caused the issue:

/* If ACT is not NULL, change the action for SIG to *ACT.
   If OACT is not NULL, put the old action for SIG in *OACT.  */
int __attribute__ ((visibility ("hidden")))
mtcp_sigaction (int sig, const struct sigaction *act,
                              struct sigaction *oact)
{
  int result;
  struct kernel_sigaction kact, koact;

  /* if sig != SIGCANCEL and sig != SIGSETXID, use glibc version */
  if (sig != 32 && sig != 33) {
    if (dmtcp_exists) /* then _real_sigaction defined by DMTCP; avoid wrapper */
      return mtcp_sigaction_entry(sig, act, oact);
    else /* this will go directly to glibc */
      return sigaction(sig, act, oact); // The program will core dump here.
  }

  /* else make direct call to kernel;
   * glibc would hide signal 32 (SIGCANCEL/SIGTIMER) and 33 (SIGSETXID) */
  if (act)
    {
      kact.k_sa_handler = act->sa_handler;
      mtcp_sys_memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
      kact.sa_flags = act->sa_flags | SA_RESTORER;
      /* If MTCP called this, then it must be for MTCP restart.  Hence, MTCP
       * had previously saved the restorer function.  act->sa_restorer is valid.
       */
      kact.sa_restorer = act->sa_restorer;
    }

  /* XXX The size argument hopefully will have to be changed to the
     real size of the user-level sigset_t.  */
  result = mtcp_sys_rt_sigaction( sig, act ? &kact : NULL,
                               oact ? &koact : NULL, _NSIG / 8);
  if (oact && result >= 0)
    {
      oact->sa_handler = koact.k_sa_handler;
      mtcp_sys_memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
      oact->sa_flags = koact.sa_flags;
      /* During checkpoint, MTCP calls this to save action for signals 32, 33
       * If glibc uses signals 32/33, it'll have already installed the restorer
       */
      oact->sa_restorer = koact.sa_restorer;
    }
  errno = mtcp_sys_errno;  /* needed for mtcp_sys_rt_sigaction */
  return result;
}


Best regards!
---------------------------------------------
guosheng_gao 高国胜
Realsil Microelectronics Inc.
Tel: +86-512-6258-8966 ext.6617
E-Mail: [email protected]<mailto:[email protected]>
---------------------------------------------


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Dmtcp-forum mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dmtcp-forum

Reply via email to