You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ntabris This one looks coiled rel;ated too, any thoughts?
E coiled.errors.ClusterCreationError: Only 9 workers ready (was waiting for at least 10). (cluster_id: 98760)
/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/coiled/_beta/cluster.py:413:
ClusterCreationError
Sometimes you don't get all the instances you want. I don't consider this a problem unless it's happening with some frequency.
In our docs, we say:
You can also set wait_for_workers to True if you want to wait for all the requested workers. This option should be used with caution when requesting large clusters, due to availability issues from the chosen cloud provider.
In each of these cases at least one of the workers dies. That's a dask problem, and maybe some on the OSS team should investigate why workers are losing connection to scheduler during test runs. For example, here's relevant bit of logs from one of the three (!) workers that did this on example (1) above:
2022-11-04 12:21:51,484 - distributed.worker - INFO - Stopping worker at tls://10.0.3.171:43013. Reason: worker-handle-scheduler-connection-broken
2022-11-04 12:21:51,490 - distributed.nanny - INFO - Closing Nanny gracefully at 'tls://10.0.3.171:34553'. Reason: worker-handle-scheduler-connection-broken
2022-11-04 12:21:51,619 - distributed.nanny - INFO - Closing Nanny at 'tls://10.0.3.171:34553'. Reason: nanny-close-gracefully
FWIW, I'd expect that benchmark code killing workings is considered a bad thing and something we'd want to track and something we'd want to look at for performance regressions.
In all of these examples, Coiled does in fact bring up replacement instances (this is because the code running in CI calls scale for each test). But... that takes some time.
That said, I'm looking at these clusters and the replacement workers come up in ~1 minute, so why are we getting 120s timeout?
Problem 2: client.restart() is where we get timeout
Why are we getting 120s timeout if the cluster.scale(10) gets us back to 10 workers in ~1 min?
To answer that, we need to look more closely at the code where the timeout is coming from, and in each of the three examples I've been given, it's this same code:
Note that the code is calling client.restart()and thenclient.scale() but never gets to client.scale() in these cases because restart is where we get timeout!
The default behavior of client.restart() is to wait for workers (ultimately by calling scheduler.restart(wait_for_workers=True).
I'm a bit concerned that this won't work if the scheduler still thinks there are N workers but one of those workers has (unknown to the scheduler) died (because it lost connection to scheduler).
Note that the small_client fixture used to do scale then wait_for_workers and then restart, change was made in 150f156 (cc @hendrikmakait who made that change).
If you do things in that order, then I don't think you'd get timeout during restart call.
Assessment/TODOs
As far as I can tell, none of this is caused by Coiled platform issues.
Workers die during tests, that should be addressed.
client.restart() has timeout in some cases (I suspect when scheduler thinks worker is alive when it isn't), You could work around this by calling scale then wait then restart like you used to, but it feels to me like there's a problem with restart that should also be addressed.
Also, I'll mention that troubleshooting would be easier if we had proper timestamps on things in runtime CI, as I've requested in #356.
Just to be clear, the original example (from 19 days ago, not 4 days ago) is a different issue:
coiled.errors.ClusterCreationError: Only 9 workers ready (was waiting for at least 10). (cluster_id: 98760)
If that's happening with increased frequency, it would require further investigation. I can do a quick check and see if I have access to data about how much that specific error is occurring.
Most recent case was 104134 and we got Server.InternalError: Internal error on launch error from AWS.
In general I'd expect this to be an AWS availability issue, but if it were to be more frequent we could try to tweak some things to get better availability.
Once after a test finishes and once before a test starts. If we only do it once, we should be good. Does anybody know why we're calling it twice? Just for good measure or is there a reason? I see this was intentional but I don't have the full context #472
Background is that even though Client|Scheduler.restart waits for the workers, the workers might still be finishing up their startup routine after they are registered to the scheduler so even Client.wait_for_workers will miss this race condition.
We have two calls to restart mostly for good measure. The one during teardown is needed to avoid problems/state spilling into subsequent tests using the same cluster. The one during setup is mostly to make sure that we do not have any stale state in the cluster since the fixture may be used without the small_client fixture and the user would then need to manually restart on teardown.
As an alternative approach with similar guarantees, we could create another function-level fixture to be used instead of small_cluster that restarts a cluster on teardown.
Side note: I've always been a little nervous about cluster reuse across these tests.
We're also not entirely happy with this. I believe package sync made it much faster but personally I still see a 1-2min startup time which is still pretty expensive compared to the test runtimes.
Edit: @ntabris I think I copy the wrong link, but isn't this kind of error the same/related?
ERROR tests/benchmarks/test_futures.py::test_single_future - coiled.errors.ClusterCreationError: Only 1 workers ready (was waiting for at least 3). (cluster_id: 112386)
ERROR tests/benchmarks/test_futures.py::test_large_map - coiled.errors.ClusterCreationError: Only 1 workers ready (was waiting for at least 3). (cluster_id: 112386)
ERROR tests/benchmarks/test_futures.py::test_large_map_first_work - coiled.errors.ClusterCreationError: Only 1 workers ready (was waiting for at least 3). (cluster_id: 112386)
ERROR tests/benchmarks/test_futures.py::test_memory_efficient - coiled.errors.ClusterCreationError: Only 1 workers ready (was waiting for at least 3). (cluster_id: 112386)
Or this could be related to the insufficient instance types. If I'm in the wrong, happy to close this and open a new issue.
Activity
ncclementi commentedon Nov 2, 2022
@ntabris This one looks coiled rel;ated too, any thoughts?
ntabris commentedon Nov 2, 2022
Sometimes you don't get all the instances you want. I don't consider this a problem unless it's happening with some frequency.
In our docs, we say:
(https://docs.coiled.io/user_guide/cluster_creation.html#waiting-for-workers)
Y'all make ~700 instances per CI run so I'm not surprised if sometimes some of those clusters don't get all the requested workers.
ncclementi commentedon Nov 4, 2022
It seems this is related https://github.com/coiled/coiled-runtime/actions/runs/3393593922/jobs/5641109480
ncclementi commentedon Nov 4, 2022
It is happening quite a bit, so I'll re-open.
[-]⚠️ CI failed ⚠️[/-][+]timeout waiting for workers[/+]ntabris commentedon Nov 8, 2022
There are three recent examples:
Problem 1: workers die during tests
In each of these cases at least one of the workers dies. That's a dask problem, and maybe some on the OSS team should investigate why workers are losing connection to scheduler during test runs. For example, here's relevant bit of logs from one of the three (!) workers that did this on example (1) above:
FWIW, I'd expect that benchmark code killing workings is considered a bad thing and something we'd want to track and something we'd want to look at for performance regressions.
In all of these examples, Coiled does in fact bring up replacement instances (this is because the code running in CI calls
scalefor each test). But... that takes some time.That said, I'm looking at these clusters and the replacement workers come up in ~1 minute, so why are we getting
120stimeout?Problem 2: client.restart() is where we get timeout
Why are we getting 120s timeout if the
cluster.scale(10)gets us back to 10 workers in ~1 min?To answer that, we need to look more closely at the code where the timeout is coming from, and in each of the three examples I've been given, it's this same code:
Note that the code is calling
client.restart()and thenclient.scale()but never gets toclient.scale()in these cases because restart is where we get timeout!The default behavior of
client.restart()is to wait for workers (ultimately by callingscheduler.restart(wait_for_workers=True).I'm a bit concerned that this won't work if the scheduler still thinks there are N workers but one of those workers has (unknown to the scheduler) died (because it lost connection to scheduler).
Note that the
small_clientfixture used to doscalethenwait_for_workersand thenrestart, change was made in 150f156 (cc @hendrikmakait who made that change).If you do things in that order, then I don't think you'd get timeout during
restartcall.Assessment/TODOs
As far as I can tell, none of this is caused by Coiled platform issues.
Workers die during tests, that should be addressed.
client.restart()has timeout in some cases (I suspect when scheduler thinks worker is alive when it isn't), You could work around this by callingscalethenwaitthenrestartlike you used to, but it feels to me like there's a problem withrestartthat should also be addressed.Also, I'll mention that troubleshooting would be easier if we had proper timestamps on things in runtime CI, as I've requested in #356.
cc @jrbourbeau @fjetter for visibility on the dask issues
ntabris commentedon Nov 8, 2022
Just to be clear, the original example (from 19 days ago, not 4 days ago) is a different issue:
If that's happening with increased frequency, it would require further investigation. I can do a quick check and see if I have access to data about how much that specific error is occurring.
ntabris commentedon Nov 8, 2022
Okay, so I looked specifically for cluster creation errors where we timed out waiting for requested number of workers.
Here's last 30 days:
https://mixpanel.com/s/3xCCvY
So... not increasing and not frequent.
Most recent case was 104134 and we got
Server.InternalError: Internal error on launcherror from AWS.In general I'd expect this to be an AWS availability issue, but if it were to be more frequent we could try to tweak some things to get better availability.
dchudz commentedon Nov 8, 2022
Sounds like (as the error says)
wait_for_workers=Falseon the restart would solve this?Then you'd get to the
scalecall, Coiled would get a chance to ask AWS for more workers for you.ntabris commentedon Nov 9, 2022
Another example: https://github.com/coiled/coiled-runtime/actions/runs/3431724130/jobs/5720185462#step:5:655
10 remaining items
ntabris commentedon Nov 14, 2022
@ncclementi fyi this uncovered legitimate issues in upstream with @fjetter is currently working on addressing
fjetter commentedon Nov 15, 2022
I created an upstream ticket for this dask/distributed#7312
Definitely looks like the worker is closed by a race condition during restart
fjetter commentedon Nov 15, 2022
Currently this looks like an issue because we're running restart while a previous restart has not completed, yet. Turns out the API we're calling on the Nanny to restart is not safe to be called concurrently, i.e. if we restart while a previous restart is still in progress, we're in a bad place.
Looks like we're doing this in
small_clienthttps://github.com/coiled/coiled-runtime/blob/43c3fe7c69aff44802fde27f29b262bbda776c2b/conftest.py#L491-L510Once after a test finishes and once before a test starts. If we only do it once, we should be good. Does anybody know why we're calling it twice? Just for good measure or is there a reason? I see this was intentional but I don't have the full context #472
cc @hendrikmakait
Background is that even though
Client|Scheduler.restartwaits for the workers, the workers might still be finishing up their startup routine after they are registered to the scheduler so evenClient.wait_for_workerswill miss this race condition.hendrikmakait commentedon Nov 15, 2022
We have two calls to
restartmostly for good measure. The one during teardown is needed to avoid problems/state spilling into subsequent tests using the same cluster. The one during setup is mostly to make sure that we do not have any stale state in the cluster since the fixture may be used without thesmall_clientfixture and the user would then need to manually restart on teardown.hendrikmakait commentedon Nov 15, 2022
As an alternative approach with similar guarantees, we could create another function-level fixture to be used instead of
small_clusterthat restarts a cluster on teardown.fjetter commentedon Nov 15, 2022
I'll push a hotfix for coiled-runtime until the distributed issue is fixed properly
dchudz commentedon Nov 15, 2022
Side note: I've always been a little nervous about cluster reuse across these tests.
I understand it saves the cost of spinup time, so maybe that's worth it? But probably does make some things harder to disentangle.
Although I guess it caught this bug, which is good.
fjetter commentedon Nov 15, 2022
We're also not entirely happy with this. I believe package sync made it much faster but personally I still see a 1-2min startup time which is still pretty expensive compared to the test runtimes.
ncclementi commentedon Nov 16, 2022
I see a lot of failures in multiple PRs and it looks like the fix proposed in #529 didn't do the trick.
see https://github.com/coiled/coiled-runtime/actions/runs/3481356463/jobs/5822478047
Edit: @ntabris I think I copy the wrong link, but isn't this kind of error the same/related?
Or this could be related to the insufficient instance types. If I'm in the wrong, happy to close this and open a new issue.
ntabris commentedon Nov 16, 2022
that's a different error, let's look more closely
fjetter commentedon Nov 16, 2022
I'll close this again to avoid mixing this up. I suggest opening a new ticket for the cluster creation error if that hasn't happened already