-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
ztest failures #989
Comments
Some investigation on the error messages themselves. There are four distinct errors:
Means that
Means that
Means that /*
* Make sure the new device is big enough.
*/
if (newvd->vdev_asize < vdev_get_min_asize(oldvd))
return (spa_vdev_exit(spa, newrootvd, txg, EOVERFLOW));
This indicates that I think we're probably dealing with multiple separate issues here. The first two issues seem to be caused by struct rlimit rl = { 1024, 1024 };
(void) setrlimit(RLIMIT_NOFILE, &rl); On my system this is a no-op, because:
The I will continue investigating tomorrow. |
This seems really hard to reproduce. I had my 50% failure rate while running 5 ztests at the same time on different trees on a single VM. Now I tested again using 5 different VMs (one for rc7, rc8, rc9, rc10 and rc11) and I only got one failure over 17 runs on each VM (6%), and each time it was |
If you suspect a resource leak, you might try running ztest through the clang static analysis tool. It might flag a file handle leak. It also sounds like this is a long standing issue. |
With a one-hour pass, all my ztest instances failed nearly simultaneously after 40 minutes with the following message:
Investigating. #36 comes to mind, but I'm running this on a 64-bit system. |
I heavily suspect that the I added some debugging printfs and they seem to indicate that ztest consistently fails when more than 33305 pthread objects are lingering around. In addition, I noticed this in the original Solaris sources: kthread_t *
zk_thread_create(void (*func)(), void *arg)
{
thread_t tid;
VERIFY(thr_create(0, 0, (void *(*)(void *))func, arg, THR_DETACHED,
&tid) == 0);
return ((void *)(uintptr_t)tid);
} Notice the This should be easy to fix. I'm on it. (Apparently, this isn't an issue in kernel space because kthreads always run detached. Can someone confirm?) |
Currently, thread_create(), when called in userspace, creates a joinable (i.e. not detached thread). This is the pthread default. Unfortunately, this does not reproduce kthreads behavior (kthreads are always detached). In addition, this contradicts the original Solaris code which creates userspace threads in detached mode. These joinable threads are never joined, which leads to a leakage of pthread thread objects ("zombie threads"). This in turn results in excessive ressource consumption, and possible ressource exhaustion in extreme cases (e.g. long ztest runs). This patch fixes the issue by creating userspace threads in detached mode. The only exception is ztest worker threads which are meant to be joinable. See issue openzfs#989.
Testing confirms that #991 fixes the thread issue. In the mean time, I got another error message related to
|
Currently, for unknown reasons, VOP_CLOSE() is a no-op in userspace. This causes file descriptor leaks. This is especially problematic with long ztest runs, since zpool.cache is opened repeatedly and never closed, resulting in resource exhaustion (EMFILE errors). This patch fixes the issue by making VOP_CLOSE() do what it is supposed to do. See issue openzfs#989.
Regarding
(and climbing) I found the culprit: #define VOP_CLOSE(vp, f, c, o, cr, ct) 0 Fixed in #992. Two issues remaining (the |
Got another one, but it seems to be extremely rare (happened only once over dozens of hours of ztesting):
This has already been reported upstream a week ago (Illumos #3212), so it's not specific to ZFS On Linux. |
Great work. I'll get all of the changes you've been working on reviewed and merged next week. |
Doh, my tests over the week-end failed, even with #991, #992, #994, #995 and #997 applied. Got a 18% failure rate (4/22) with three-hour passes. Here are the errors:
After 50 minutes. Classic segfault.
After nearly 3 hours. We already got this one. I thought it was gone, turns out it isn't.
After nearly 3 hours. Seems like some sort of mutex corruption.
After 2 hours. @behlendorf: considering these failures seem to only occur on long runs (> 30 minutes), you should be fine if you stick with a default 5-minute ztest in your testing chain, for now. |
While ztest was running, I took a look at the files in |
Still needs more testing, but right now ztest has been running happily for 25 hours (8 three-hour passes) without a hitch. Judging from other tests I don't think it's 100% stable quite yet, but it's very close. |
Currently, thread_create(), when called in userspace, creates a joinable (i.e. not detached thread). This is the pthread default. Unfortunately, this does not reproduce kthreads behavior (kthreads are always detached). In addition, this contradicts the original Solaris code which creates userspace threads in detached mode. These joinable threads are never joined, which leads to a leakage of pthread thread objects ("zombie threads"). This in turn results in excessive ressource consumption, and possible ressource exhaustion in extreme cases (e.g. long ztest runs). This patch fixes the issue by creating userspace threads in detached mode. The only exception is ztest worker threads which are meant to be joinable. Signed-off-by: Brian Behlendorf <[email protected]> Issue #989
Currently, for unknown reasons, VOP_CLOSE() is a no-op in userspace. This causes file descriptor leaks. This is especially problematic with long ztest runs, since zpool.cache is opened repeatedly and never closed, resulting in resource exhaustion (EMFILE errors). This patch fixes the issue by making VOP_CLOSE() do what it is supposed to do. Signed-off-by: Brian Behlendorf <[email protected]> Issue #989
Currently, in several instances (but not all), ztest generates vdev file paths using a statement similar to this: snprintf(path, sizeof (path), ztest_dev_template, ...); This worked fine until 40b84e7, which changed path to be a pointer to the heap instead of an array allocated on the stack. Before this change, sizeof(path) would return the size of the array; now, it returns the size of the pointer instead. As a result, the aforementioned sprintf statement uses the wrong size and truncates the vdev file path to the first 4 or 8 bytes (depending on the architecture). Typically, with default settings, the file path will become "/tmp/zt" instead of "/test/ztest.XXX". This issue only exists in ztest_vdev_attach_detach() and ztest_fault_inject(), which explains why ztest doesn't fail right away. Signed-off-by: Brian Behlendorf <[email protected]> Issue #989
With the above patches merged ztest is again running fairly reliably for short durations so I've re-enabled it in my test suite. However, there are still a few of recent upstream Illumos ztest fixes we'll want to port. |
illumos-gate/commit/9253d63df408bb48584e0b1abfcc24ef2472382e Illumos changeset: 13840:97fd5cdf328a 3145 single-copy arc 3212 ztest: race condition between vdev_online() and spa_vdev_remove() Reviewed by: Matt Ahrens <[email protected]> Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Eric Schrock <[email protected]> Reviewed by: Justin T. Gibbs <[email protected]> Approved by: Eric Schrock <[email protected]> Ported-by: Brian Behlendorf <[email protected]> Issue openzfs#989 Issue openzfs#1137
3145 single-copy arc 3212 ztest: race condition between vdev_online() and spa_vdev_remove() Reviewed by: Matt Ahrens <[email protected]> Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Eric Schrock <[email protected]> Reviewed by: Justin T. Gibbs <[email protected]> Approved by: Eric Schrock <[email protected]> References: illumos-gate/commit/9253d63df408bb48584e0b1abfcc24ef2472382e illumos changeset: 13840:97fd5cdf328a https://www.illumos.org/issues/3145 https://www.illumos.org/issues/3212 Ported-by: Brian Behlendorf <[email protected]> Closes openzfs#989 Closes openzfs#1137
…nt (openzfs#989) Bumps [serde_path_to_error](https://github.com/dtolnay/path-to-error) from 0.1.11 to 0.1.12. - [Release notes](https://github.com/dtolnay/path-to-error/releases) - [Commits](dtolnay/path-to-error@0.1.11...0.1.12) --- updated-dependencies: - dependency-name: serde_path_to_error dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Testing on 37abac6, with the reguid test disabled because of #939, over 23 instances of
ztest -P 1200 -T 3600
, roughly 50% (12/23) of the instances failed. Here are the 12 errors:I have no idea if this is a regression or not. I'll try to bisect and/or isolate the corrupting test if there is one, but this is likely to be very time-consuming: if there's a 50% chance of success, it means I have to get 5 consecutive successes (= 5 hours without errors) to be 98% sure that the code being tested is good.
The text was updated successfully, but these errors were encountered: