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

Really excise tinythread #4106

Merged
merged 3 commits into from
Dec 31, 2023
Merged

Conversation

dhthwy
Copy link
Contributor

@dhthwy dhthwy commented Dec 26, 2023

Takeover #2516

There is a deadlock when quitting df. I haven't looked into it much yet.

@ab9rf will you test this on Windows when you get a chance? And I'm curious if the hang is reproducible there.

@dhthwy
Copy link
Contributor Author

dhthwy commented Dec 26, 2023

Looks like it's a case of double locking the mutex in PluginManager's Plugin::RefLock wait() line 106. So yeah, should be able to reproduce.

@@ -34,7 +34,7 @@ distribution.
#include "Hooks.h"
#include <stdio.h>

#include "tinythread.h"
#include "../plugins/uicommon.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this included? it concerns me that a plugin header is included from Core. Moreover, what is Core doing that is provided by uicommon?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to look into that. Wasn't me that put that in there, at least on purpose. Could've been a rebase screwup.

plugins/rendermax/renderer_light.cpp Outdated Show resolved Hide resolved
@myk002
Copy link
Member

myk002 commented Dec 27, 2023

tests show what appears to be a deadlock on Windows. looking at the test artifacts, it appears that the hang happens as soon as the test script is run -- I don't see any output from the tests themselves, or even any output that indicates that the test files are being scanned and prepared.

@dhthwy
Copy link
Contributor Author

dhthwy commented Dec 27, 2023

That sucks. It seems to run ok on Linux, including the tests.

@dhthwy dhthwy force-pushed the really-excise-tinythread branch 2 times, most recently from cf45476 to df38aaa Compare December 27, 2023 23:58
Remove useless tinythread import in PlugLoad-windows.cpp

Remove seemingly useless tinythread import in LuaTools.cpp

Factor out tinythread in LuaApi.cpp

Removed unused tinythread in LuaWrapper.cpp

Removed unused tinythread include in LuaTypes.cpp

Removed unused tinythread include in ColorText.cpp

Factor out tinythread in Console.h

Factor out tinythread in Console-posix.cpp

Factor out tinythread in Console-windows.cpp

Factor out tinythread in renderer_light

Factor out tinythread in DataDefs.cpp

Remove unused tinythread include in RemoteClient.cpp

Add includes for new mutex and conditional_variable usages in PluginManager

Factor out tinythread from devel/memview, renderermax/renderer_light, and rendermax/renderer_opengl plugins

Remove usages of tinythread in various CMakeLists.txt files, in .ycm_extra_conf.py, and delete tinythread itself

Delete tinythread from LISCENSE.rst

excise tinythread: fix deadlock in pluginmanager

excise tinythread: remove improper header

excise tinythread: fix double unlock. fix plugin typo
@dhthwy dhthwy force-pushed the really-excise-tinythread branch from df38aaa to 54769eb Compare December 28, 2023 00:23
Copy link
Member

@myk002 myk002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll have to test the changes to rendermax in 0.47.05. it hasn't been updated to work with v50 yet. I don't think it's even being built atm

@myk002
Copy link
Member

myk002 commented Dec 28, 2023

FWIW, I'd be happy if you just added a comment to rendermax that improvements could be made and that the threading needs verification and leave it at that. I wouldn't want it holding this PR up indefinitely.

@dhthwy
Copy link
Contributor Author

dhthwy commented Dec 28, 2023

Whichever is fine. A comment is a good start at any rate.

@dhthwy
Copy link
Contributor Author

dhthwy commented Dec 28, 2023

I did change the isDone bool to an std::atomic. I'm confident (not that it means much) that change won't do any harm except for make it run a tiny bit slower. But that said, I can revert that commit if you'd rather keep it separate and worry about it later.

rendermax: note that this plugin needs testing and improvements
@dhthwy dhthwy force-pushed the really-excise-tinythread branch from 174bc8e to ee61835 Compare December 28, 2023 02:33
@myk002 myk002 merged commit abfbfd5 into DFHack:develop Dec 31, 2023
14 checks passed
@dhthwy dhthwy deleted the really-excise-tinythread branch January 6, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants