Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ray TPU Webhook] Pod Informer inconsistency for large RayCluster sizes #858

Open
ryanaoleary opened this issue Oct 25, 2024 · 1 comment · May be fixed by #859
Open

[Ray TPU Webhook] Pod Informer inconsistency for large RayCluster sizes #858

ryanaoleary opened this issue Oct 25, 2024 · 1 comment · May be fixed by #859
Assignees

Comments

@ryanaoleary
Copy link
Collaborator

ryanaoleary commented Oct 25, 2024

The Ray TPU webhook sometimes fails to assign unique TPU_WORKER_IDs to all workers in a slice, resulting in the Jax initialization timing out. In manual testing this only occurs with large slice sizes (i.e. a v6e-256) around ~20% of the time (2 out of 10 trials) and is not reproduced in unit tests. I've previously tested the webhook with up to 4x4x8 v4 slices and did not observe this issue. The error is consistently fixed by re-creating the RayCluster. Initial debugging yielded the following results:

  1. I initially thought the bug was due to a race condition with multiple concurrent mutation requests, but adding a sync.Mutex lock for the Pod mutation yielded no change. Additionally, mutating admission webhooks appear to execute requests sequentially, although I'm unclear whether this behavior is specific to Gatekeeper.
  2. Log statements show that the error occurs when an admission request calculates the next TPU_WORKER_ID with a stale Informer cache (the PodLister does not show the updated TPU_WORKER_ID from the previous request) and re-assigns a worker ID.
  3. Adding an additional WaitForCacheSync has no effect and checking cache.WaitForCacheSync(stopCh, podInformer.HasSynced) returns true even when the error occurs.
  4. Adding a sufficiently long time.Sleep() after the Mutate function solves the issue but adds significant latency.

It appears the bug is a result of a slow update time to the PodInformer cache for a large number of KubeRay worker Pods. I'm currently investigating a better method to ensure the PodInformer retains an up-to-date list of Pods without resorting to calling time.Sleep().

@ryanaoleary ryanaoleary self-assigned this Oct 25, 2024
@ryanaoleary
Copy link
Collaborator Author

cc: @andrewsykim

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 a pull request may close this issue.

1 participant