Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Assertion (memory leak) in ntcf_system.t TC 28 (SunOS, select, dynamic load balancing) #63

Open
smtrfnv opened this issue Jul 31, 2023 · 1 comment

Comments

@smtrfnv
Copy link
Contributor

smtrfnv commented Jul 31, 2023

Sometimes there is an assertion happening in ntcf_system.t TC 28, it appears only on SunOS when select driver is used and dynamic load balancing is enabled.

[ W ][ 31JUL2023_13:13:04.846 ][             main ][                   ntcf_system.t.cpp:9054 ]: ETIMEDOUT/ECONNREFUSED/ECONNABORTED (x100) (instantaneous)
[ F ][ 31JUL2023_13:13:05.157 ][             main ][                  ntcf_system.t.cpp:11084 ]: Assertion failed: ta.numBlocksInUse() == 0
@smtrfnv
Copy link
Contributor Author

smtrfnv commented Sep 29, 2023

There is a race condition occuring during ntcr::Interface::shutdown() process.
Scenario is the following:

  1. resolver->shutdown(); is called. Which leads to the ntcdns::System::shutdown() execution.
    ntcdns::System::shutdown() does not drain its d_threadPool_sp or wait for complition of all enqued jobs, it justs sets d_state to e_STATE_STOPPING state.
  2. resolver->shutdown(); then stops all reactor threads.
  3. It can happen that all reactor threads manage to stop earlier than all ntcdns::System resolver jobs are processed. And when the last reactor thread is deregistered from the reactor it flushes it.
  4. ntcdns::System jobs are processed. The results of processing with E_CANCELLED status are pushed to the only one strand, but this strand is never processed by reactor threads, as they are stopped. Thus ntcr::StreamSocket, ntcr::Strand and the resolver itself are not deleted (as callback itself contain pointers to them)

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

No branches or pull requests

1 participant