Skip to content

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

Open
@chenbq83

Description

@chenbq83
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions