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

Crash in logger during shutdown. #247

Open
linas opened this issue Mar 1, 2021 · 1 comment
Open

Crash in logger during shutdown. #247

linas opened this issue Mar 1, 2021 · 1 comment

Comments

@linas
Copy link
Member

linas commented Mar 1, 2021

When the CogServer is shut down, there is a shared-library dtor race condition, where the cogutil logger threads are still running, even though the shared library is now gone. This looks like a crash, but the crash occurs only after the cogserver has exited (and after all unit tests have passed.) This makes test passes look like failures.

This only happens once out of every ten runs.

I first spotted this many years ago, and have repeatedly spent a lot of time trying to fix it, by adding more locks, a few sleep()s here and there, and any other trick I could think of, including not calling delete and making class dtors into no-ops. Despite great effort, I've been unable to find a fix. It seems appropriate to report this as a formal bug.

This is most easily demonstrated with the unit tests in https://github.com/opencog/atomspace-cog/ which "always" consistently pass... and then commonly crash during the shared library unload when the cogserver is stopped. This is ugly and undesired. (Out of 24 unit tests, it is likely that at least one will crash due to this bug.)

@linas
Copy link
Member Author

linas commented Mar 7, 2021

One thing I have not tried, yet -- using

__attribute__((destructor (PRIORITY)))

for the shared-lib dtors. The higher-priority dtors will run earlier.

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