Skip to content

Commit 1ea34ca

Browse files
larseggertNot-Nik
authored andcommitted
fix: Remove the "init NSS twice" tests (#1937)
They seem to have a race condition that makes them crash. I wasn't able to figure out why they crash, this seems to happen inside NSS: ``` Process 47677 stopped * thread mozilla#2, name = 'init_twice_withdb', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x000000019b4994f8 libsystem_pthread.dylib`pthread_mutex_lock + 12 libsystem_pthread.dylib`pthread_mutex_lock: -> 0x19b4994f8 <+12>: ldr x8, [x0] 0x19b4994fc <+16>: mov w9, #0x545a ; =21594 0x19b499500 <+20>: movk w9, #0x4d55, lsl mozilla#16 0x19b499504 <+24>: cmp x8, x9 (lldb) up frame mozilla#1: 0x0000000100802f58 libnspr4.dylib`PR_Lock + 20 libnspr4.dylib`PR_Lock: -> 0x100802f58 <+20>: bl 0x10080c0c0 ; symbol stub for: pthread_self 0x100802f5c <+24>: str x0, [x19, #0xb8] 0x100802f60 <+28>: mov w8, #0x1 ; =1 0x100802f64 <+32>: str w8, [x19, #0xb0] (lldb) up frame mozilla#2: 0x00000001007fc188 libnspr4.dylib`PR_CallOnce + 56 libnspr4.dylib`PR_CallOnce: -> 0x1007fc188 <+56>: ldr w23, [x19] 0x1007fc18c <+60>: ldr w20, [x19, #0x8] 0x1007fc190 <+64>: ldr x0, [x22, #0x430] 0x1007fc194 <+68>: bl 0x100802f74 ; PR_Unlock (lldb) up frame mozilla#3: 0x000000010066f634 libnss3.dylib`nss_Init + 112 libnss3.dylib`nss_Init: -> 0x10066f634 <+112>: cbz w0, 0x10066f640 ; <+124> 0x10066f638 <+116>: mov w19, #-0x1 ; =-1 0x10066f63c <+120>: b 0x10066f968 ; <+932> 0x10066f640 <+124>: stp x21, x22, [x29, #-0x80] (lldb) up frame mozilla#4: 0x000000010066ff44 libnss3.dylib`NSS_Initialize + 100 libnss3.dylib`NSS_Initialize: -> 0x10066ff44 <+100>: ldp x29, x30, [sp, #0x40] 0x10066ff48 <+104>: add sp, sp, #0x50 0x10066ff4c <+108>: ret libnss3.dylib`NSS_InitContext: 0x10066ff50 <+0>: sub sp, sp, #0x60 (lldb) up frame mozilla#5: 0x00000001000035fc init-d4e9f02b33e50e46`init::init_twice_withdb::h34013f715e9b4f6e at init.rs:65:9 62 let pathstr = path.to_str().unwrap(); 63 let dircstr = CString::new(pathstr).unwrap(); 64 unsafe { -> 65 nss::NSS_Initialize( 66 dircstr.as_ptr(), 67 empty.as_ptr(), 68 empty.as_ptr(), ```
1 parent 5089f3f commit 1ea34ca

1 file changed

Lines changed: 0 additions & 35 deletions

File tree

tests/init.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,6 @@ fn init_nodb() {
3535
}
3636
}
3737

38-
#[cfg(nss_nodb)]
39-
#[test]
40-
fn init_twice_nodb() {
41-
unsafe {
42-
nss::NSS_NoDB_Init(std::ptr::null());
43-
assert_ne!(nss::NSS_IsInitialized(), 0);
44-
}
45-
// Now do it again
46-
init_nodb();
47-
}
48-
4938
#[cfg(not(nss_nodb))]
5039
#[test]
5140
fn init_withdb() {
@@ -55,27 +44,3 @@ fn init_withdb() {
5544
assert_ne!(nss::NSS_IsInitialized(), 0);
5645
}
5746
}
58-
59-
#[cfg(not(nss_nodb))]
60-
#[test]
61-
fn init_twice_withdb() {
62-
use std::{ffi::CString, path::PathBuf};
63-
64-
let empty = CString::new("").unwrap();
65-
let path: PathBuf = ::test_fixture::NSS_DB_PATH.into();
66-
assert!(path.is_dir());
67-
let pathstr = path.to_str().unwrap();
68-
let dircstr = CString::new(pathstr).unwrap();
69-
unsafe {
70-
nss::NSS_Initialize(
71-
dircstr.as_ptr(),
72-
empty.as_ptr(),
73-
empty.as_ptr(),
74-
nss::SECMOD_DB.as_ptr().cast(),
75-
nss::NSS_INIT_READONLY,
76-
);
77-
assert_ne!(nss::NSS_IsInitialized(), 0);
78-
}
79-
// Now do it again
80-
init_withdb();
81-
}

0 commit comments

Comments
 (0)