Skip to content

Conversation

snwoods
Copy link
Contributor

@snwoods snwoods commented Jul 1, 2025

As per the commit message for fbda87d (12 years ago): "[ECONNREFUSED retry logic] probably should be pushed into the generic XCP function, since the same behaviour will probably be expected for other interfaces." and David was right!

Moving the functionality to Xcp_client.ml itself so that it isn't duplicated across 3 different clients.

let rec retry_econnrefused f =
try f () with
| Unix.Unix_error (Unix.ECONNREFUSED, "connect", _) ->
(* debug "Caught ECONNREFUSED; retrying in 5s"; *)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was commented out when moved from xenops_server_xen.ml to Storage_client.ml (the commit I mentioned in the description.) I'm not sure if it was considered spammy or if we'd be interested in it? It's been commented out for 12 years... :P

(* debug "Caught ECONNREFUSED; retrying in 5s"; *)
Thread.delay 5. ; retry_econnrefused f
| e ->
(* error "Caught %s: does the service need restarting?"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're raising the error anyway, so I don't know if this message adds any more context that we'd need?

(Printexc.to_string e); *)
raise e

(* TODO: use_switch=false as the message switch doesn't handle raw HTTP very well *)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a TODO in the original code, but it's clearly never been TODONE.

@snwoods snwoods added this pull request to the merge queue Jul 3, 2025
Merged via the queue into xapi-project:master with commit 4fb79a7 Jul 3, 2025
16 checks passed
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.

3 participants