Skip to content

Manage ICP ports using a Runner#2365

Open
yadij wants to merge 2 commits intosquid-cache:masterfrom
yadij:arc-runner-3
Open

Manage ICP ports using a Runner#2365
yadij wants to merge 2 commits intosquid-cache:masterfrom
yadij:arc-runner-3

Conversation

@yadij
Copy link
Contributor

@yadij yadij commented Jan 31, 2026

No description provided.

@rousskov rousskov self-requested a review February 1, 2026 03:56
@rousskov rousskov added the S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box label Feb 1, 2026
Copy link
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

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

I plan to come back to this PR after the backlog is cleared.


/// \ingroup ServerProtocolICPAPI
void icpClosePorts(void);
/// Perform a graceful shutdown of ICP listening and sending ports (if any)
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not clear to me what "graceful shutdown" implies in this context. Moreover, I do not think this function actually shuts down any ports -- the ports may continue to be open after this function returns. If fixing existing icpClosePorts() problems is outside this PR scope, then I recommend not adding any description of this problematic function in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not clear to me what "graceful shutdown" implies in this context. Moreover, I do not think this function actually shuts down any ports -- the ports may continue to be open after this function returns.

In other words; the global port references are set to "closed" (for new activity), while the ports themselves are left to be closed "gracefully" (via RAII) when the last active transaction using them is done.

* to that specific interface. During shutdown, we must
* disable reading on the outgoing socket.
*/
assert(Comm::IsConnOpen(icpOutgoingConn));
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAICT, the removed assert checked an invariant that this function still uses. The assert did not check everything it should have checked, but do we have to remove it in this PR?

Copy link
Contributor Author

@yadij yadij Feb 7, 2026

Choose a reason for hiding this comment

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

This is legacy code which would crash with assertion on shutdown when the ICP incoming and outgoing ports were the same.

This PR uses our current code style (used for other similar ports), which prevents these assertions from occuring by closing the out-port when it is open and leaving it as a reference to a closed port if it is a duplicate of the in-port.

  • on shutdown any hanging reference will be dropped by the system.
  • on reconfigure the reference will be unconditionally replaced with a new open one.
  • we can be extra paranoid and move icpOutgoingConn = nullptr; outside the new if-statement to free the memory early as-needed.

@rousskov rousskov removed the S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box label Feb 2, 2026
Delay closing the ICP ports until grace period
for client transactions has ended.

On FATAL/death/abort events do not close,
which matches other port handling cleanly
and leaves port information in core dumps
in case it is relevant.
@yadij yadij requested a review from rousskov February 8, 2026 16:10
@yadij yadij added the S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box label Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants