container icon indicating copy to clipboard operation
container copied to clipboard

[Bug]: Callback Management

Open dkovba opened this issue 1 year ago • 5 comments

Created from https://github.com/apple/container/issues/167.

I have done the following

  • [x] I have searched the existing issues
  • [ ] If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

Not applicable.

Current behavior

Callback Management

  • Completion handlers are used throughout the XPC communication
  • There's potential for callbacks to be invoked in unexpected order
  • Some callbacks may never be called if a race condition occurs

Expected Behavior

Callback Invocation

  • Each callback should be invoked exactly once
  • Callbacks should occur even if the connection is terminated
  • Proper timeout and cancellation handling

Ordered Execution

  • Operations with dependencies should be executed in the correct order
  • Results should be delivered in a predictable sequence
  • Long-running operations shouldn't block critical path operations

Environment

Not applicable.

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

dkovba avatar Jun 27 '25 18:06 dkovba

@dcantah Will cont.resume() crash when we hit a timeout and execute group.cancelAll() first in XPCClient.send()? @crosbymichael Should we preserve execution order when calling handleMessage() in XPCServer.handleClientConnection()?

dkovba avatar Jun 27 '25 22:06 dkovba

@dkovba Do you mean preserve ordering in terms of submitting the item for execution or the responses as well?

crosbymichael avatar Jul 02 '25 16:07 crosbymichael

@crosbymichael It seems we currently add tasks in the order the objects are received, but their execution and replies may happen in any order, and replies can arrive out of order. Likely, there is nothing wrong with this.

dkovba avatar Jul 02 '25 17:07 dkovba

I agree, I think the current flow is correct for a server component.

crosbymichael avatar Jul 02 '25 18:07 crosbymichael

Going to close this out, but if we find specific examples of places we have an issue we can open them with more details.

dcantah avatar Nov 04 '25 21:11 dcantah