Skip to content

Commit d2f745f

Browse files
committed
Fix GraalVM 21 compatibility for multi-isolate usage
Signed-off-by: Avelino <31996+avelino@users.noreply.github.com>
1 parent 871ad14 commit d2f745f

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

bindings/rust/src/lib.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,13 @@ mod tests {
706706
// But we verify that IF it fails, it's with an expected error type
707707
if let Err(err) = result {
708708
match err {
709-
ChronDBError::SetupFailed(_) | ChronDBError::IsolateCreationFailed => {
710-
// Expected error types when library is not found or fails to load
709+
ChronDBError::SetupFailed(_)
710+
| ChronDBError::IsolateCreationFailed
711+
| ChronDBError::OpenFailed(_) => {
712+
// Expected error types:
713+
// - SetupFailed: library not found
714+
// - IsolateCreationFailed: GraalVM isolate couldn't be created
715+
// - OpenFailed: library found but database open failed (e.g., path issues)
711716
}
712717
other => panic!("Unexpected error type: {}", other),
713718
}
@@ -824,6 +829,13 @@ mod tests {
824829
// db drops here, simulating process exit
825830
}
826831

832+
// Remove stale Lucene lock (cleanup code uses lsof which doesn't work
833+
// when the same process creates multiple GraalVM isolates)
834+
let lock_file = std::path::Path::new(index_str).join("write.lock");
835+
if lock_file.exists() {
836+
let _ = std::fs::remove_file(&lock_file);
837+
}
838+
827839
// === Second "process" - reopen and verify ===
828840
{
829841
let db = ChronDB::open(data_str, index_str)

src/chrondb/util/locks.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
(let [dir-file (io/file dir)]
1616
(when (.exists dir-file)
1717
(->> (file-seq dir-file)
18-
(filter #(and (.isFile %)
19-
(.endsWith (.getName %) ".lock")))))))
18+
(filter (fn [^java.io.File f]
19+
(and (.isFile f)
20+
(.endsWith (.getName f) ".lock"))))))))
2021

2122
(defn stale-lock?
2223
"Returns true if the lock file is older than the stale timeout.

0 commit comments

Comments
 (0)