Skip to content

Commit 9c564e1

Browse files
authored
CA-424473 Fix OpaqueRef:NULL in vm import (#6933)
The `check_references` function needs to skip null reference before calling `get_snapshot`, or it will try to fetch a database record for Ref.null, leading to an exception.
2 parents c3e54bc + 6f5a6c0 commit 9c564e1

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

ocaml/xapi/import.ml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,12 +2141,16 @@ let check_references ~__context (table : table) =
21412141
(Diagnostic.show_path path)
21422142
(Ref.string_of r)
21432143
in
2144-
let rec go (clazz, _, r) =
2145-
match get_snapshot ~clazz ~r with
2146-
| Some record ->
2147-
Diagnostic.visit_references check_reference clazz record
2148-
| _ ->
2149-
debug "Could not find imported object %s" r
2144+
let go (clazz, _, r) =
2145+
(* Ref.null will lead to a get_record failure *)
2146+
if Ref.of_string r = Ref.null then
2147+
()
2148+
else
2149+
match get_snapshot ~clazz ~r with
2150+
| Some record ->
2151+
Diagnostic.visit_references check_reference clazz record
2152+
| _ ->
2153+
debug "Could not find imported object %s" r
21502154
in
21512155
List.iter go table
21522156

0 commit comments

Comments
 (0)