Skip to content

xapi: Fix pool.join breaking due to dangling ref - #7365

Open
last-genius wants to merge 2 commits into
xapi-project:masterfrom
last-genius:asv/dangling_local_cache_sr
Open

last-genius wants to merge 2 commits into
xapi-project:masterfrom
last-genius:asv/dangling_local_cache_sr

Conversation

@last-genius

Copy link
Copy Markdown
Contributor

SR.forget can create a dangling reference in Host.local_cache_sr. During
pool join, this will prevent the supporter host from creating its host object
on the coordinator, which leads to a broken supporter host:

[debug||pool.join|xapi_pool] Found no host with uuid = 'SUPPORTER' on the master, so creating one.
[debug||pool.join|xapi_pool] Ignoring exception: Db_exn.DBCache_NotFound("missing row", "SR", "OpaqueRef:DANGLING")
[error||pool.join|backtrace] Raised Db_exn.DBCache_NotFound("missing row", "SR", "OpaqueRef:DANGLING")
[error||pool.join|backtrace] 1/5 xapi Raised at file ocaml/database/db_cache_impl.ml, line 151
[error||pool.join|backtrace] 2/5 xapi Called from file ocaml/xapi/db_actions.ml, line 14885
[error||pool.join|backtrace] 3/5 xapi Called from file ocaml/xapi/xapi_pool.ml, line 1101
[error||pool.join|backtrace] 4/5 xapi Called from file ocaml/xapi/xapi_pool.ml, line 1539
[error||pool.join|backtrace] 5/5 xapi Called from file lib/backtrace.ml, line 110

In case of an error, simply set Host.local_cache_sr to Ref.null and continue.
Thus, after the fix:

[debug||pool.join|xapi_pool] Found no host with uuid = 'SUPPORTER' on the master, so creating one.
[debug||pool.join|xapi_pool] Creating host object on master

SR.destroy above has the same assert, duplicate it for forget as well.

Forgetting a local cache SR currently leads to a dangling reference, which in
turn prevents pool join from completing successfully.

Signed-off-by: Andrii Sultanov <andriy.sultanov@vates.tech>
SR.forget can create a dangling reference in Host.local_cache_sr. During
pool join, this will prevent the supporter host from creating its host object
on the coordinator, which leads to a broken supporter host:

    [debug||pool.join|xapi_pool] Found no host with uuid = 'SUPPORTER' on the master, so creating one.
    [debug||pool.join|xapi_pool] Ignoring exception: Db_exn.DBCache_NotFound("missing row", "SR", "OpaqueRef:DANGLING")
    [error||pool.join|backtrace] Raised Db_exn.DBCache_NotFound("missing row", "SR", "OpaqueRef:DANGLING")
    [error||pool.join|backtrace] 1/5 xapi Raised at file ocaml/database/db_cache_impl.ml, line 151
    [error||pool.join|backtrace] 2/5 xapi Called from file ocaml/xapi/db_actions.ml, line 14885
    [error||pool.join|backtrace] 3/5 xapi Called from file ocaml/xapi/xapi_pool.ml, line 1101
    [error||pool.join|backtrace] 4/5 xapi Called from file ocaml/xapi/xapi_pool.ml, line 1539
    [error||pool.join|backtrace] 5/5 xapi Called from file lib/backtrace.ml, line 110

In case of an error, simply set Host.local_cache_sr to Ref.null and continue.
Thus, after the fix:

    [debug||pool.join|xapi_pool] Found no host with uuid = 'SUPPORTER' on the master, so creating one.
    [debug||pool.join|xapi_pool] Creating host object on master

Signed-off-by: Andrii Sultanov <andriy.sultanov@vates.tech>
@last-genius

Copy link
Copy Markdown
Contributor Author

I tested this manually - pool.join works after the fix and is broken without it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant