Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DCE application crashes when calling atexit handlers if it "never ends" #135

Open
chenbq83 opened this issue Oct 11, 2022 · 0 comments
Open

Comments

@chenbq83
Copy link

  • ns3 version (cat $NS3FOLDER/VERSION or the commit hash): ns-3.35
  • DCE version (git log|head -n1): dce-1.11
  • Operating system/version (lsb_release -a): Ubuntu 16.04.7 LTS
  • Libc version (ldd -v): libc-2.23
  • compiler version (gcc -v/g++ -v/clang -v/clang++ -v): gcc version 7.5.0

Description of the problem

I run my application on DCE, and it crashes when test ends. The application is something like a server, so it "never ended" when the whole test ends. It crashes when some global variable's destructor of this application is being called. and it crashes because some local variable on the stack has not yet released (because the process is still "run").

I guess this might be a problem of DCE. DCE calls the process's atexit handlers on TaskManager::DoDispose() while some objects on stack are never released. As a workaround, I skip the "dce___cxa_finalize " call.

What is your opinion? and how to fix this? Thanks

void TaskManager::DoDispose (void)
{
  if (m_disposing)
    {
      return;
    }
  m_disposing = 1;

  // Flush every FILEs in every processes.
  Ptr<DceManager> dceManager = this->GetObject<DceManager> ();

  if (0 != dceManager)
    {
      std::map<uint16_t, Process *> procs = dceManager->GetProcs ();
      std::map<uint16_t, Process *>::iterator it;

      for (it = procs.begin (); it != procs.end (); it++)
        {
          if (0 != it->second)
            {
              gDisposingThreadContext = it->second->threads.back ();

              // call atexit handler for linux kernel
              // dce___cxa_finalize (0);                                         <<<<<<< Skip the atexit handler 
              if (0 != gDisposingThreadContext)
                {
                  Process *p = it->second;
                  for (std::vector<FILE *>::const_iterator i = p->openStreams.begin ();
                       i != p->openStreams.end (); ++i)
                    {
                      fflush (*i);
                    }
                }
              gDisposingThreadContext = 0;
            }
        }
    }
  Object::DoDispose ();
}

output of ./waf configure

None

Steps to reproduce

None

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant