-
Notifications
You must be signed in to change notification settings - Fork 44
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
Stack Overflow on Windows only (regression 1.1.0) #23
Comments
The internal data structure was rewritten in #22 to use a concurrent vector instead of a hash table. It should behave identically to the previous version, just faster. Can you get a backtrace of the crash> |
Hmm, the stacktrace just points to the function where it happens bindgen: if clang_sys::is_loaded() {
return;
}
// XXX (issue #350): Ensure that our dynamically loaded `libclang`
// doesn't get dropped prematurely, nor is loaded multiple times
// across different threads.
lazy_static! {
static ref LIBCLANG: std::sync::Arc<clang_sys::SharedLibrary> = {
clang_sys::load().expect("Unable to find libclang");
clang_sys::get_library().expect(
"We just loaded libclang and it had better still be \
here!",
)
};
}
clang_sys::set_library(Some(LIBCLANG.clone()));
pub fn is_loaded() -> bool {
LIBRARY.with(|l| l.borrow().is_some())
}
#[allow(dead_code)]
pub fn load() -> Result<(), String> {
let library = Arc::new(load_manually()?);
LIBRARY.with(|l| *l.borrow_mut() = Some(library));
Ok(())
} thread_local!(static LIBRARY: RefCell<Option<Arc<SharedLibrary>>> = RefCell::new(None));
pub fn get_library() -> Option<Arc<SharedLibrary>> {
LIBRARY.with(|l| l.borrow_mut().clone())
}
pub fn set_library(library: Option<Arc<SharedLibrary>>) -> Option<Arc<SharedLibrary>> {
LIBRARY.with(|l| mem::replace(&mut *l.borrow_mut(), library))
} I am not sure where exactly the stack overflow happens, it looks like a conflict with the use of |
Can you give me instructions to reproduce this crash? I'll have a look. |
I've prepared a branch with all unnecessary build steps removed. With git clone https://github.com/pragmatrix/rust-skia.git --branch thread-local-issue-23
cd rust-skia
cargo build -vv the stack overflow should be reproducible on a Windows machine. |
I've forgot, you also need a recent version of the Microsoft Build Tools and clang/libclang (LLVM) in the path. |
I'm running this on Linux but can't reproduce the issue. |
Can you post a full backtrace from the debugger? If it's a stack overflow then it should be repeating itself with the same functions getting called recursively. |
Also note that the |
The actual recursion steps aren't shown in Visual Studio, the function
Thank you for pointing to that. I've removed some of the regular expression strings that set up the options for Bindgen, and after a certain number, the stack overflow disappeared. For now it seems to be related to the number of regular expressions that are initialized before Bindgen is started. |
Maybe the regex are misbehaving somehow? Can you check if the same options are passed to bindgen with thread_local 1.0.1 vs 1.1.0? |
A recent update to regex version 1.4.4 (which removes the thread_local dependency), causes a stack overflow on Windows at the same build step, too. The scope of this problem seems to widen: rust-lang/regex#750 |
This doesn't seem to be a problem with |
Hi, maintainer of rust-skia here. Since a two days we were getting stack overflow errors with a binding generation step on Windows only on our nightly builds, and the cause was a transitive SemVer update of
thread_local
dependency from1.0.1
to1.1.0
.Sticking to
1.0.1
fixed the issue.Here is the dependency tree:
Any ideas what could have caused that?
The text was updated successfully, but these errors were encountered: