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

ZFS corruption related to snapshots post-2.0.x upgrade #12014

Open
jgoerzen opened this issue May 8, 2021 · 145 comments
Open

ZFS corruption related to snapshots post-2.0.x upgrade #12014

jgoerzen opened this issue May 8, 2021 · 145 comments
Labels
Component: Encryption "native encryption" feature Status: Triage Needed New issue which needs to be triaged Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@jgoerzen
Copy link

jgoerzen commented May 8, 2021

System information

Type Version/Name
Distribution Name Debian
Distribution Version Buster
Linux Kernel 5.10.0-0.bpo.5-amd64
Architecture amd64
ZFS Version 2.0.3-1~bpo10+1
SPL Version 2.0.3-1~bpo10+1

Describe the problem you're observing

Since upgrading to 2.0.x and enabling crypto, every week or so, I start to have issues with my zfs send/receive-based backups. Upon investigating, I will see output like this:

zpool status -v
  pool: rpool
 state: ONLINE
status: One or more devices has experienced an error resulting in data
	corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
	entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
  scan: scrub repaired 0B in 00:03:37 with 0 errors on Mon May  3 16:58:33 2021
config:

	NAME         STATE     READ WRITE CKSUM
	rpool        ONLINE       0     0     0
	  nvme0n1p7  ONLINE       0     0     0

errors: Permanent errors have been detected in the following files:

        <0xeb51>:<0x0>

Of note, the <0xeb51> is sometimes a snapshot name; if I zfs destroy the snapshot, it is replaced by this tag.

Bug #11688 implies that zfs destroy on the snapshot and then a scrub will fix it. For me, it did not. If I run a scrub without rebooting after seeing this kind of zpool status output, I get the following in very short order, and the scrub (and eventually much of the system) hangs:

[393801.328126] VERIFY3(0 == remove_reference(hdr, NULL, tag)) failed (0 == 1)
[393801.328129] PANIC at arc.c:3790:arc_buf_destroy()
[393801.328130] Showing stack for process 363
[393801.328132] CPU: 2 PID: 363 Comm: z_rd_int Tainted: P     U     OE     5.10.0-0.bpo.5-amd64 #1 Debian 5.10.24-1~bpo10+1
[393801.328133] Hardware name: Dell Inc. XPS 15 7590/0VYV0G, BIOS 1.8.1 07/03/2020
[393801.328134] Call Trace:
[393801.328140]  dump_stack+0x6d/0x88
[393801.328149]  spl_panic+0xd3/0xfb [spl]
[393801.328153]  ? __wake_up_common_lock+0x87/0xc0
[393801.328221]  ? zei_add_range+0x130/0x130 [zfs]
[393801.328225]  ? __cv_broadcast+0x26/0x30 [spl]
[393801.328275]  ? zfs_zevent_post+0x238/0x2a0 [zfs]
[393801.328302]  arc_buf_destroy+0xf3/0x100 [zfs]
[393801.328331]  arc_read_done+0x24d/0x490 [zfs]
[393801.328388]  zio_done+0x43d/0x1020 [zfs]
[393801.328445]  ? zio_vdev_io_assess+0x4d/0x240 [zfs]
[393801.328502]  zio_execute+0x90/0xf0 [zfs]
[393801.328508]  taskq_thread+0x2e7/0x530 [spl]
[393801.328512]  ? wake_up_q+0xa0/0xa0
[393801.328569]  ? zio_taskq_member.isra.11.constprop.17+0x60/0x60 [zfs]
[393801.328574]  ? taskq_thread_spawn+0x50/0x50 [spl]
[393801.328576]  kthread+0x116/0x130
[393801.328578]  ? kthread_park+0x80/0x80
[393801.328581]  ret_from_fork+0x22/0x30

However I want to stress that this backtrace is not the original cause of the problem, and it only appears if I do a scrub without first rebooting.

After that panic, the scrub stalled -- and a second error appeared:

zpool status -v
  pool: rpool
 state: ONLINE
status: One or more devices has experienced an error resulting in data
	corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
	entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
  scan: scrub in progress since Sat May  8 08:11:07 2021
	152G scanned at 132M/s, 1.63M issued at 1.41K/s, 172G total
	0B repaired, 0.00% done, no estimated completion time
config:

	NAME         STATE     READ WRITE CKSUM
	rpool        ONLINE       0     0     0
	  nvme0n1p7  ONLINE       0     0     0

errors: Permanent errors have been detected in the following files:

        <0xeb51>:<0x0>
        rpool/crypt/debian-1/home/jgoerzen/no-backup@[elided]-hourly-2021-05-07_02.17.01--2d:<0x0>

I have found the solution to this issue is to reboot into single-user mode and run a scrub. Sometimes it takes several scrubs, maybe even with some reboots in between, but eventually it will clear up the issue. If I reboot before scrubbing, I do not get the panic or the hung scrub.

I run this same version of ZoL on two other machines, one of which runs this same kernel version. What is unique about this machine?

  • It is a laptop
  • It uses ZFS crypto (the others use LUKS)

I made a significant effort to rule out hardware issues, including running several memory tests and the built-in Dell diagnostics. I believe I have rules that out.

Describe how to reproduce the problem

I can't at will. I have to wait for a spell.

Include any warning/errors/backtraces from the system logs

See above

Potentially related bugs

@jgoerzen jgoerzen added Status: Triage Needed New issue which needs to be triaged Type: Defect Incorrect behavior (e.g. crash, hang) labels May 8, 2021
@jgoerzen
Copy link
Author

jgoerzen commented May 8, 2021

Two other interesting tidbits...

When I do the reboot after this issue occurs, the mounting of the individual zfs datasets is S L O W. Several seconds each, and that normally just flies by. After scrubbing, it is back to normal speed of mounting.

The datasets that have snapshot issues vary with each one. Sometimes it's just one, sometimes many. But var is almost always included. (Though its parent, which has almost no activity ever, also is from time to time, so that's odd.)

@jstenback
Copy link
Contributor

Same symptoms here, more or less. See also issue #11688.

@glueckself
Copy link

glueckself commented May 9, 2021

I also have the symptom with the corrupted snapshots, without kernel panics so far.

So far it only affected my Debian system with Linux 5.10 and zfs 2.0.3 (I've turned the server off for today, I can check the exact versions tomorrow). Also, while the system has the 2.0.3 zfs utils + module, the pool is still left on 0.8.6 format. I wasn't able to execute zfs list -r -t all <affected dataset> - it displayed cannot iterate filesystems and only a few snapshots (instead of tens it should've). Also, I couldn't destroy the affected snapshots because it said they didn't exist anymore. I couldn't send the dataset with syncoid at all.

On the corrupted system, after I got the mail from ZED, I manually ran a scrub at first, after which the zpool status said that there were no errors. However, the next zpool status, seconds after the first, again said that there were errors. Subsequent scrubs didn't clean the errors.

I've rebooted the server into an Ubuntu 20.10 live with zfs 0.8.4-1ubuntu11 (again, sorry that I haven't noted the version, can add it tomorrow) and after a scrub the errors were gone. Following scrubs haven't detected errors anymore. zfs list -r -t all ... again displayed a large list of snapshots.

The errors didn't seem to affect the data on the zvols (all 4 affected snapshots are of zvols). The zvols are used as disks for VMs with ext4 on them. I will verify them tomorrow.
EDIT: I checked one of the VM disks, neither fsck nor dpkg -V (verify checksums of all files installed from a package) could find any errors (except mismatching dpkg-checksums of config files I've changed - that is to be expected).

I have two other Ubuntu 21.04 based Systems with zfs-2.0.2-1ubuntu5 which are not affected until now. However, they have their pools already upgraded to 2. All are snapshotted with sanoid and have the datasets encrypted.

My next step will be to downgrade zfs back to 0.8.6 on the Debian system and see what happens.

EDIT:
More points I've noted while investigating with 0.8.4-1ubuntu11:

  • Creating new snapshots continued working for affected datasets, however destroying them didn't (right now I have 127 "frequently" (sanoids term for the most often snapshot - in my case 15 minutes) instead of the 10 sanoid is configured to keep.
  • With 0.8, the destroying of the affected snapshots worked. Scrubbing afterwards didn't find any errors.

EDIT 2:

  • On 2.0.2 (Ubuntu 21.04 again), sanoid managed to successfully prune (destroy) all remaining snapshots that past their valid-time. A scrub afterwards didn't find any errors. I'll be running the 2.0.2 for a while and see what happens.

@dcarosone
Copy link

dcarosone commented May 21, 2021

I'm seeing this too, on Ubuntu 21.04, also using zfs encryption

I have znapzend running, and it makes a lot of snapshots. Sometimes, some of them are bad, and can't be used (for example, attempting to send them to a replica destination fails). I now use the skipIntermediates option, and so at least forward progress is made on the next snapshot interval.

In the most recent case (this morning) I had something like 4300 errors (many more than I'd seen previously). There are no block-level errors (read/write/cksum). They're cleared after destroying the affected snapshots and scrubbing (and maybe a reboot, depending on .. day?)

Warning! Speculation below:

  • this may be related to a race condition?
  • znapzend wakes up and makes recursive snapshots of about 6 first-level child datasets ot rpool (ROOT, home, data, ...) all at the same time (as well as a couple of other pools, some of those still using LUKS for encryption underneath instead).
  • I have been having trouble with the ubuntu-native zsysd, whch gets stuck at 100% cpu. Normally I get frustrated and just disable it.
  • However, recently, I have been trying to understand what it's doing and what's going wrong (it tries to collect every dataset and snapshot and property in memory on startup). It seems like this has happened several times in the past few days while I have been letting zsysd run (so more contention for libzfs operations)
  • Update I haven't seen this again since disabling zsysd .. ~3 weeks and counting.

@aerusso
Copy link
Contributor

aerusso commented Jun 12, 2021

@jgoerzen Can you

  1. Capture the zpool events -v report when one of these "bad" snapshots is created?
  2. Try to zfs send that snapshot (i.e., to zfs send ... | cat >/dev/null; notice the need to use cat).
  3. Reboot, and try to zfs send the snapshot.

In my case, #11688 (which you already reference), I've discovered that rebooting "heals" the snapshot -- at least using the patchset I mentioned there

@jgoerzen
Copy link
Author

I'll be glad to. Unfortunately, I rebooted the machine yesterday, so I expect it will be about a week before the problem recurs.

It is interesting to see the discussion today in #11688. The unique factor about the machine that doesn't work for me is that I have encryption enabled. It wouldn't surprise me to see the same thing here, but I will of course wait for it to recur and let you know.

@jgoerzen
Copy link
Author

Hello @aerusso,

The problem recurred over the weekend and I noticed it this morning.

Unfortunately, the incident that caused it had already expired out of the zpool events buffer (apparently), as it only went as far back as less than an hour ago. However, I did find this in syslog:

Jun 20 01:17:39 athena zed: eid=34569 class=authentication pool='rpool' bookmark=12680:0:0:98
Jun 20 01:17:39 athena zed: eid=34570 class=data pool='rpool' priority=2 err=5 flags=0x180 bookmark=12680:0:0:242
Jun 20 01:17:40 athena zed: eid=34571 class=data pool='rpool' priority=2 err=5 flags=0x180 bookmark=12680:0:0:261
...
Jun 20 17:17:39 athena zed: eid=37284 class=authentication pool='rpool' bookmark=19942:0:0:98
Jun 20 17:17:39 athena zed: eid=37285 class=data pool='rpool' priority=2 err=5 flags=0x180 bookmark=19942:0:0:242
Jun 20 17:17:40 athena zed: eid=37286 class=data pool='rpool' priority=2 err=5 flags=0x180 bookmark=19942:0:0:261
...
Jun 20 18:17:28 athena zed: eid=37376 class=data pool='rpool' priority=2 err=5 flags=0x180 bookmark=21921:0:0:2072
Jun 20 18:17:29 athena zed: eid=37377 class=authentication pool='rpool' priority=2 err=5 flags=0x80 bookmark=21921:0:0:2072
Jun 20 18:17:29 athena zed: eid=37378 class=data pool='rpool' priority=2 err=5 flags=0x80 bookmark=21921:0:0:2072
Jun 20 18:17:40 athena zed: eid=37411 class=authentication pool='rpool' bookmark=21923:0:0:0

It should be noted that my hourly snap/send stuff runs at 17 minutes past the hour, so that may explain this timestamp correlation.

zpool status reported:

  pool: rpool
 state: ONLINE
status: One or more devices has experienced an error resulting in data
	corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
	entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
  scan: scrub repaired 0B in 00:04:12 with 0 errors on Sun Jun 13 00:28:13 2021
config:

	NAME         STATE     READ WRITE CKSUM
	rpool        ONLINE       0     0     0
	  nvme0n1p7  ONLINE       0     0     0

errors: Permanent errors have been detected in the following files:

        <0x5c81>:<0x0>
        <0x3188>:<0x0>
        rpool/crypt/debian-1@athena-hourly-2021-06-20_23.17.01--2d:<0x0>
        rpool/crypt/debian-1/var@athena-hourly-2021-06-20_23.17.01--2d:<0x0>
        <0x4de6>:<0x0>

Unfortunately I forgot to attempt to do a zfs send before reboot. Those snapshots, though not referenced directly, would have been included in a send -I that would have been issued. From my logs:

Jun 20 18:17:03 athena simplesnapwrap[4740]: Running: /sbin/zfs send -I rpool/crypt/debian-1/var@__simplesnap_bakfs1_2021-06-20T22:17:02__ rpool/crypt/debian-1/var@__simplesnap_bakfs1_2021-06-20T23:17:03__
Jun 20 18:17:03 athena simplesnap[2466/simplesnapwrap]: internal error: warning: cannot send 'rpool/crypt/debian-1/var@athena-hourly-2021-06-20_23.17.01--2d': Invalid argument

So I think that answers the question.

After a reboot but before a scrub, the zfs send you gave executes fine.

@cbreak-black
Copy link

I have similar symptoms, on an encrypted single-ssd ubuntu 21.04 boot pool, using stock zfs from ubuntu's repos. Deleting the affected snapshots and scrubbing previously cleared the errors, but on reoccurence, repeated scrubbing (without deleting them) caused a deadlock. My system has ECC memory, so it's probably not RAM related.

  • Does this problem happen with slower pools (like hard disk pools?)
  • Does this problem happen with pools that have redundancy?
  • Does this problem happen with with pools that don't trim (hard disk pools again?)

@aerusso
Copy link
Contributor

aerusso commented Jul 4, 2021

@cbreak-black Was there a system restart between the occurrence of the corrupted snapshot and the problems? Restarting has "fixed" this symptom for me (though you will need to scrub twice for the message to disappear, I believe).

I have a suspicion that this may be a version of #10737 , which has an MR under way there. The behavior I am experiencing could be explained by that bug (syncoid starts many zfs sends on my machine, some of which are not finished; SSDs do the send much faster, so are more likely to get deeper into the zfs send before the next command in the pipeline times out; a reboot heals the issue, for me; there's no on disk corruption, as far as I can tell).

I'm holding off on trying to bisect this issue (at least) until testing that MR. (And all the above is conjecture!)

@cbreak-black
Copy link

@aerusso No, without a restart I got into the scrub-hang, and had to restart hard. Afterwards, the scrub finished, and several of the errors vanished. The rest of the errors vanished after deleting the snapshots and scrubbing again.

@InsanePrawn
Copy link
Contributor

InsanePrawn commented Jul 4, 2021

Can I join the club too? #10019
Note how it's also at 0x0. Sadly I deleted said snapshot and dataset by now.

@aerusso
Copy link
Contributor

aerusso commented Jul 4, 2021

@InsanePrawn I can't seem to find commit 4d5b4a33d in any repository I know of (and neither can github, apparently, either). However, in your report you say this was a "recent git master" and the commit I'm currently betting on being guilty is da92d5c, which was committed in November of the previous year, so I can't use your data point to rule out my theory!

Also, it sounds like you didn't have any good way to reproduce the error --- however, you were using a test pool. Compared to my reproduction strategy (which is just, turn my computer on and browse the web, check mail, etc.) it might be easier to narrow in on a test case (or might have been easier a year and a half ago, when this was all fresh). Anyway, if you have any scripts or ideas of what you were doing that caused this besides "snapshots being created and deleted every couple minutes", it might be useful too. (I already tried lots of snapshot creations and deletions during fio on several datasets in a VM).

@InsanePrawn
Copy link
Contributor

InsanePrawn commented Jul 4, 2021

Yeah, idk why I didn't go look for the commit in my issue - luckily for us, that server (and pool; it does say yolo, but it's my private server's root pool. it's just that i won't cry much if it breaks; originally due to then unreleased crypto) and the git repo on it still exist. Looks like 4d5b4a33d was two systemd-generator commits by me after 610eec4

@InsanePrawn
Copy link
Contributor

InsanePrawn commented Jul 4, 2021

FWIW the dataset the issue appeared on was an empty filesystem (maybe a single small file inside) dataset that had snapshots (without actual fs activity) taken in quick intervals (somewhere between 30s and 5m intervals) in parallel with a few (5-15) other similarly empty datasets.
Edit: These were being snapshotted and replicated by zrepl, probably in a similar manner to what znapzend does.

The pool is a raidz2 on 3.5" spinning SATA disks.
I'm afraid I have nothing more to add in terms of reproduction :/

Edit: Turns out the dataset also still exists, the defective snapshot however does not anymore. I doubt that's helpful?

@aerusso
Copy link
Contributor

aerusso commented Jul 5, 2021

@InsanePrawn Does running the zrepl workload reproduce the bug on 2.0.5 (or another recent release?)

I don't think the snapshot is terribly important --- unless you're able to really dig into it with zdb (which I have not developed sufficient expertise to do). Rather, I think it's the workload, hardware setup, and (possibly, but I don't understand the mechanism at all) the dataset itself. Encryption also is a common theme, but that might just affect the presentation (i.e., there's no MAC to fail in the unencrypted, unauthenticated, case).

Getting at zpool events -v showing the error would probably tell us something (see mine).

@cbreak-black
Copy link

I've since added redundancy to my pool (it's now a mirror with two devices), and disabled autotrim. The snapshot corruption still happens. Still don't know what is causing it. And I also don't know if the corruption happens when creating the snapshot, and only later gets discovered (when I try to zfs send the snapshots), or if snapshots get corrupted some time in between creation and sending.

@aerusso
Copy link
Contributor

aerusso commented Aug 14, 2021

@cbreak-black Can you enable the all-debug.sh ZEDlet, and put the temporary directory somewhere permanent (i.e., not the default of /tmp/zed.debug.log)?

This will get the output of zpool events -v as it is generated, and will give times, which you can conceivably triangulate with your other logs. There's other information in those logs that is probably useful, too.

I'll repeat this here: if anyone gets me a reliable reproducer on a new pool, I have no doubt we'll be able to solve this in short order.

@wohali
Copy link

wohali commented Sep 1, 2021

Just mentioning here that we saw this on TrueNAS 12.0-U5 with OpenZFS 2.0.5 as well -- see #11688 (comment) for our story.

@rincebrain
Copy link
Contributor

Since I don't see anyone mentioning it here yet, #11679 contains a number of stories about the ARC getting confused when encryption is involved and, in a very similar looking illumos bug linked from there, eating data at least once.

@gamanakis
Copy link
Contributor

gamanakis commented Sep 30, 2021

@jgoerzen are you using raw send/receive? If yes this is closely related to #12594.

@jgoerzen
Copy link
Author

@gamanakis Nope, I'm not using raw (-w).

@phreaker0
Copy link

it's present in v2.1.1 as well:

Okt 09 01:01:14 tux sanoid[2043026]: taking snapshot ssd/container/debian-test@autosnap_2021-10-08_23:01:14_hourly
Okt 09 01:01:16 tux sanoid[2043026]: taking snapshot ssd/container/debian-test@autosnap_2021-10-08_23:01:14_frequently
Okt 09 01:01:16 tux kernel: VERIFY3(0 == remove_reference(hdr, NULL, tag)) failed (0 == 1)
Okt 09 01:01:16 tux kernel: PANIC at arc.c:3836:arc_buf_destroy()
Okt 09 01:01:16 tux kernel: Showing stack for process 435
Okt 09 01:01:16 tux kernel: CPU: 2 PID: 435 Comm: z_rd_int_1 Tainted: P           OE     5.4.0-84-generic #94-Ubuntu
Okt 09 01:01:16 tux kernel: Hardware name: GIGABYTE GB-BNi7HG4-950/MKHM17P-00, BIOS F1 05/24/2016
Okt 09 01:01:16 tux kernel: Call Trace:
Okt 09 01:01:16 tux kernel:  dump_stack+0x6d/0x8b
Okt 09 01:01:16 tux kernel:  spl_dumpstack+0x29/0x2b [spl]
Okt 09 01:01:16 tux kernel:  spl_panic+0xd4/0xfc [spl]
Okt 09 01:01:16 tux kernel:  ? kfree+0x231/0x250
Okt 09 01:01:16 tux kernel:  ? spl_kmem_free+0x33/0x40 [spl]
Okt 09 01:01:16 tux kernel:  ? kfree+0x231/0x250
Okt 09 01:01:16 tux kernel:  ? zei_add_range+0x140/0x140 [zfs]
Okt 09 01:01:16 tux kernel:  ? spl_kmem_free+0x33/0x40 [spl]
Okt 09 01:01:16 tux kernel:  ? zfs_zevent_drain+0xd3/0xe0 [zfs]
Okt 09 01:01:16 tux kernel:  ? zei_add_range+0x140/0x140 [zfs]
Okt 09 01:01:16 tux kernel:  ? zfs_zevent_post+0x234/0x270 [zfs]
Okt 09 01:01:16 tux kernel:  arc_buf_destroy+0xfa/0x100 [zfs]
Okt 09 01:01:16 tux kernel:  arc_read_done+0x251/0x4a0 [zfs]
Okt 09 01:01:16 tux kernel:  zio_done+0x407/0x1050 [zfs]
Okt 09 01:01:16 tux kernel:  zio_execute+0x93/0xf0 [zfs]
Okt 09 01:01:16 tux kernel:  taskq_thread+0x2fb/0x510 [spl]
Okt 09 01:01:16 tux kernel:  ? wake_up_q+0x70/0x70
Okt 09 01:01:16 tux kernel:  ? zio_taskq_member.isra.0.constprop.0+0x60/0x60 [zfs]
Okt 09 01:01:16 tux kernel:  kthread+0x104/0x140
Okt 09 01:01:16 tux kernel:  ? task_done+0xb0/0xb0 [spl]
Okt 09 01:01:16 tux kernel:  ? kthread_park+0x90/0x90
Okt 09 01:01:16 tux kernel:  ret_from_fork+0x1f/0x40

@phreaker0
Copy link

@aerusso you wrote that da92d5c may be the cause of this issue. My workstation at work panics after a couple of days and I need to reset it. Could you provide a branch of 2.1.1 with this commit reverted (as revert causes merge conflicts I can't fix myself) so I could test if the machine no longer crashes?

@aerusso
Copy link
Contributor

aerusso commented Oct 14, 2021

@phreaker0 Unfortunately, the bug that da92d5c introduced (#10737) was fixed by #12299, which I believe is present in all maintained branches now. It does not fix #11688, (which I suspect is the same as this bug).

I'm currently running 0.8.6 on Linux 5.4.y, and am hoping to wait out this bug (I don't have a lot of time right now, or for the foreseeable future). But, If you have a reliable reproducer (or a whole lot of time) you could bisect while running 5.4 (or some other pre-5.10 kernel). I can help anyone who wants to do that. If we can find the guilty commit, I have no doubt this can be resolved.

@rincebrain
Copy link
Contributor

Are you still seeing any errors with scrub tripping assertions, or is this "just" the snapshots reporting errors?

If the snapshots are always from things that were sent+received, could you possibly look at which snapshots this happened with, and then we can try to see what differs on both sides?

@Blackclaws
Copy link

Blackclaws commented Dec 28, 2023

For us its always the sending side that's (falsely) reporting the corruption, there is no way to compare anything as the snapshots aren't even sent out. Rebooting the system allows sending the snapshots fine again, so I guess its some sort of corruption that happens in memory only and isn't an actual corruption of the underlying data.

Scrubbing without rebooting does not solve the issue either. Scrubs don't destroy or corrupt anything further though, its just that the only thing fixing this is a reboot.

@IvanVolosyuk
Copy link

We have some hope that the root cause for this issue is the same as #15526 . We are not sure, because we can not really reproduce it, other then just having it running for a few weeks. When we read about the corruption issue in 2.2 being caused by a long present underlying issue, we had some hope that solving that, would also solve the issue here. We are currently running 2.1.14 for 18 days now, without triggering the corruption. This doesn't mean anything yet, but we're still hopeful. Has anyone run into this issue yet on 2.1.14 or 2.2.2?

The mentioned issue never causes scrub errors as corruption happens during read or omitted read specifically.

@ofthesun9
Copy link
Contributor

@rincebrain I still have the issue with zfs 2.2.2

The "corrupted" snaphost will be reported/triggered during a "zfs send"

the log will display something like:

Dec 22 18:08:17 styx syncoid[2047838]: Sending incremental Pool1/ENCR/DATA/pv@autosnap_2023-12-22_14:00:30_hourly ... autosnap_2023-12-22_17:00:32_frequently (~ 4.1 MB):
Dec 22 18:08:19 styx syncoid[2047880]: warning: cannot send 'Pool1/ENCR/DATA/pv@autosnap_2023-12-22_16:15:14_frequently': Input/output error
Dec 22 18:08:19 styx zed[2047929]: eid=28826 class=data pool='Pool1' priority=2 err=5 flags=0x180 bookmark=83312:0:0:2078

A reboot will make the snapshot accessible again. Doing twice a scrub will clear the error reported by zpool status.

I noticed that syncoid is doing a zfs send -nvP -I to get the size of the transfer, and then a zfs send -I to actually perform the transfer, that eventually would fail.

I have added a sleep(5); between the two zfs send in syncoid script to see if something different would happen. (too soon to be conclusive for the time being)

@J0riz
Copy link

J0riz commented Jan 3, 2024

As my colleague @tjikkun hoped unfortunately #15526 does not resolve the issue.
The issue still exist with ZFS 2.1.14

The 'corrupt' snapshot indeed never gets send after the corrupt snapshots starting to exist.
Doing a reboot and two scrubs fixes the issue and makes the snapshot okay again. Also the snapshots gets correctly send to the remote server afterwards.

Don't know if the sending is related to the cause of this issue. Although ZFS starts to notice the corruption during a ZFS send attempt.

 zpool status -v
  pool: userdata
 state: ONLINE
status: One or more devices has experienced an error resulting in data
	corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
	entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
  scan: scrub repaired 0B in 00:25:21 with 0 errors on Mon Dec 11 17:30:22 2023
config:

	NAME                        STATE     READ WRITE CKSUM
	userdata                    ONLINE       0     0     0
	  mirror-0                  ONLINE       0     0     0
	    scsi-SERIAL1  ONLINE       0     0     0
	    scsi-SERIAL2  ONLINE       0     0     0
	  mirror-1                  ONLINE       0     0     0
	    scsi-SERIAL3  ONLINE       0     0     0
	    scsi-SERIAL4  ONLINE       0     0     0
	spares
	  scsi-SERIAL5    AVAIL   
	  scsi-SERIAL6    AVAIL   

errors: Permanent errors have been detected in the following files:

        userdata/usr-local@hostbackup_1hour-2024-01-01-2200:<0x0>

Errors during ZFS send attempts of the corrupt snapshot:

Jan 01 23:43:37 storagehost zed[1175206]: eid=95933 class=authentication pool='userdata' bookmark=91038:0:0:0
Jan 02 00:44:11 storagehost zed[1453743]: eid=96236 class=authentication pool='userdata' bookmark=91038:0:0:0
Jan 02 01:44:12 storagehost zed[1720919]: eid=96446 class=authentication pool='userdata' bookmark=91038:0:0:0
Jan 02 02:43:40 storagehost zed[1973009]: eid=96574 class=authentication pool='userdata' bookmark=91038:0:0:0
Jan 02 03:43:40 storagehost zed[2227976]: eid=96704 class=authentication pool='userdata' bookmark=91038:0:0:0
Jan 02 04:43:51 storagehost zed[2479810]: eid=96897 class=authentication pool='userdata' bookmark=91038:0:0:0
etc...

@ofthesun9
Copy link
Contributor

I noticed that syncoid is doing a zfs send -nvP -I to get the size of the transfer, and then a zfs send -I to actually perform the transfer, that eventually would fail.

I have added a sleep(5); between the two zfs send in syncoid script to see if something different would happen. (too soon to be conclusive for the time being)

Unfortunately, the above attempt failed, I had the bug happening his morning.

I had a look at /proc/spl/kstat/zfs/dbgmsg, and among lot of lines, I found the following, starting to be reported at the time of the "zfs send" operation:

  • zio_crypt.c:476:zio_do_crypt_uio(): error 52
  • zio.c:571:zio_decrypt(): error 5
1704431303   zio_crypt.c:476:zio_do_crypt_uio(): error 52
1704431303   zio.c:571:zio_decrypt(): error 5
1704431303   zfeature.c:239:feature_get_refcount(): error 95
1704431303   dmu.c:471:dmu_spill_hold_existing(): error 2
1704431303   sa.c:368:sa_attr_op(): error 2
1704431303   zfs_dir.c:1204:zfs_get_xattrdir(): error 2
1704431303   dsl_dir.c:1347:dsl_dir_tempreserve_impl(): error 28
1704431303   zio_crypt.c:476:zio_do_crypt_uio(): error 52
1704431303   zio.c:571:zio_decrypt(): error 5
1704431303   zfeature.c:239:feature_get_refcount(): error 95
1704431303   zio_crypt.c:476:zio_do_crypt_uio(): error 52
1704431303   zio.c:571:zio_decrypt(): error 5
1704431303   zfeature.c:239:feature_get_refcount(): error 95
1704431303   zio_crypt.c:476:zio_do_crypt_uio(): error 52
1704431303   zio.c:571:zio_decrypt(): error 5
1704431303   zfeature.c:239:feature_get_refcount(): error 95
1704431303   zio_crypt.c:476:zio_do_crypt_uio(): error 52
1704431303   zio.c:571:zio_decrypt(): error 5
1704431303   zfeature.c:239:feature_get_refcount(): error 95
1704431303   dmu.c:471:dmu_spill_hold_existing(): error 2
1704431303   sa.c:368:sa_attr_op(): error 2
1704431303   zfs_dir.c:1204:zfs_get_xattrdir(): error 2
1704431303   dsl_dir.c:1347:dsl_dir_tempreserve_impl(): error 28
1704431303   dsl_dir.c:1347:dsl_dir_tempreserve_impl(): error 28
1704431303   dsl_dir.c:1347:dsl_dir_tempreserve_impl(): error 28
1704431303   dmu.c:471:dmu_spill_hold_existing(): error 2
1704431303   sa.c:368:sa_attr_op(): error 2
1704431303   zfs_dir.c:1204:zfs_get_xattrdir(): error 2
1704431303   dmu.c:471:dmu_spill_hold_existing(): error 2
1704431303   sa.c:368:sa_attr_op(): error 2
1704431303   zfs_dir.c:1204:zfs_get_xattrdir(): error 2
1704431303   zio_crypt.c:476:zio_do_crypt_uio(): error 52
1704431303   zio.c:571:zio_decrypt(): error 5

@J0riz
Copy link

J0riz commented Jan 15, 2024

On the same staging server the issue came back again after 9 days. We are unable to directly reproduce the behaviour but if we leave the system running with a ZFS version higher than 0.8.6 it occurs with encrypted snapshots after a few days or weeks.

zpool status -v
 pool: userdata
state: ONLINE
status: One or more devices has experienced an error resulting in data
   corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
   entire pool from backup.
  see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
 scan: scrub repaired 0B in 00:25:22 with 0 errors on Thu Jan 11 17:30:23 2024
config:

   NAME                        STATE     READ WRITE CKSUM
   userdata                    ONLINE       0     0     0
     mirror-0                  ONLINE       0     0     0
       scsi-SERIAL1  ONLINE       0     0     0
       scsi-SERIAL2  ONLINE       0     0     0
     mirror-1                  ONLINE       0     0     0
       scsi-SERIAL3  ONLINE       0     0     0
       scsi-SERIAL4  ONLINE       0     0     0
   spares
     scsi-SERIAL5    AVAIL   
     scsi-SERIAL6    AVAIL   

errors: Permanent errors have been detected in the following files:

       userdata/etc-virtual@hostbackup_1hour-2024-01-12-0700:<0x0>
       userdata/var-container@hostbackup_4hour-2024-01-12-0701:<0x0>

We are unable to read all the data from the local corrupted snaphot as ZFS is unable to mount it:

[root@storagehost hostbackup_4hour-2024-01-12-0701]# pwd
/var/container/.zfs/snapshot/hostbackup_4hour-2024-01-12-0701
[root@storagehost hostbackup_4hour-2024-01-12-0701]# find .
.

The following logs in /proc/spl/kstat/zfs/dbgmsg once when trying to read data from the corrupted snapshot:

1705048095   zfs_ctldir.c:1140:zfsctl_snapshot_mount(): Unable to automount /var/container/.zfs/snapshot/hostbackup_4hour-2024-01-12-0701 error=256

After a while we are again able to read the data in the snapshot content. But nothing particular seems to be logged in /proc/spl/kstat/zfs/dbgmsg what solves it.

[root@storagehost hostbackup_4hour-2024-01-12-0701]# cd /var/container/.zfs/snapshot/hostbackup_4hour-2024-01-12-0701
[root@storagehost hostbackup_4hour-2024-01-12-0701]# ls
folder1 folder2 file1 file2 file3 etc...

The behaviour that a snapshot gets noticed as corrupted as far as we can pinpoint happens during or somewhere arround a ZFS send to external backup server.

Jan 12 08:43:56 storagehost sudo[1214307]: backup : TTY=unknown ; PWD=/script/sendsnapshot ; USER=root ; COMMAND=/sbin/zfs hold remote_sync_anchor userdata/var-container@hostbackup_4hour-2024-01-12-0701
Jan 12 08:43:56 storagehost sudo[1214307]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 12 08:43:56 storagehost sudo[1214307]: pam_unix(sudo:session): session closed for user root
Jan 12 08:43:56 storagehost sudo[1214556]: backup : TTY=unknown ; PWD=/script/sendsnapshot ; USER=root ; COMMAND=/sbin/zfs send -I userdata/var-container@hostbackup_1hour-2024-01-12-0600 userdata/var-container@hostbackup_4hour-2024-01-12-0701
Jan 12 08:43:56 storagehost sudo[1214556]: pam_unix(sudo:session): session opened for user root by (uid=0)

Rebooting the server and performing two scrubs again fixes the errors.

I added additional journal and /proc/spl/kstat/zfs/dbgmsg logs in the attachment:
journal+dbgmsg-logs.txt

@gdevenyi
Copy link
Contributor

Please rename this issue to include the term "encryption"

@rincebrain rincebrain added the Component: Encryption "native encryption" feature label Jan 15, 2024
@dcarosone
Copy link

A small note FWIW, I have a system (laptop) that used to produce this issue reasonably regularly (noted somewhere way above). The issue persisted through changes of OS (ubuntu -> nixos), obviously changes of zfs version over time, and a change of the internal SSD (but not the pool, the swap was a mirror and detach).

Anyway, none of this is conclusive, and of course I'm tempting fate by posting this, but I think the change that made the difference was of replication target. I use znapzend to take and send snapshots, to two destinations.

In the original setup, one of the destinations was a remote server, the other was a second pool on USB disks (with LUKS) that I would attach from time to time. I reconfigured that a while ago to use two different remote servers, and around the same time switched to using raw sends. I'm pretty sure I haven't seen the problem since.

@vuongtuha
Copy link

Man, I wish all of you can make confirmation that problem only occurs with encrypted pool (native or LUKS). Little bit nervous for my system

@rincebrain
Copy link
Contributor

LUKS or unencrypted don't seem to have this problem.

I also would suspect 2.2.5+ won't have this problem, if it's #11679, with #16104 in 2.2.5.

@scratchings
Copy link

I've been running 2.2.6 on a machine that was exhibiting the snapshot corruption issue for just over a week now, and haven't had a reoccurrence yet, but too early to be certain.

@HankB
Copy link

HankB commented Sep 18, 2024 via email

@scratchings
Copy link

I can confirm that 2.2.6 does not fix this snapshot corruption for me (or indeed the kernel panics and hanging zfs processes on the receiving end).

@amano-kenji
Copy link

@scratchings I want to make sure your errors weren't caused by RAM bitflips.

If you disassemble your computer, remove dust, and assemble it again, does the issue disappear? A lot of dust tends to cause errors in random computer parts. Sometimes, dust causes errors in RAM or GPU.

@J0riz
Copy link

J0riz commented Oct 2, 2024

Also can confirm that with ZFS 2.2.6 the problem unfortunately still exists. On a staging system an encrypted snapshot showed up as 'corrupt' after the snapshot was created. Although rebooting the server makes the data in the snapshot available again.

We are still unable to reproduce it. Although writing more data to the filesystem maybe seems to help in the issue to arise.
Now we needed to wait about 16 days for the issue to show up.

 zpool status -v -t
  pool: userdata
 state: ONLINE
status: One or more devices has experienced an error resulting in data
	corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
	entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
  scan: scrub repaired 0B in 00:14:47 with 0 errors on Mon Sep 23 13:42:53 2024
config:

	NAME                                STATE     READ WRITE CKSUM
	userdata                            ONLINE       0     0     0
	  mirror-0                          ONLINE       0     0     0
	    nvme-SERIAL1  ONLINE       0     0     0  block size: 512B configured, 4096B native  (100% trimmed, completed at Mon Sep 23 13:18:42 2024)
	    nvme-SERIAL2  ONLINE       0     0     0  block size: 512B configured, 4096B native  (100% trimmed, completed at Mon Sep 23 13:18:40 2024)
	spares
	  nvme-SERIAL3  AVAIL     (untrimmed)

errors: Permanent errors have been detected in the following files:

        userdata/root-fs@hostbackup_1hour-2024-10-01-1800:<0x0>

Errors during ZFS send attempts of the corrupt snapshot:

Oct 01 20:46:20 server zed[1254305]: eid=23332 class=authentication pool='userdata' bookmark=21992:0:0:0
Oct 01 21:32:37 server zed[1465726]: eid=23455 class=authentication pool='userdata' bookmark=21992:0:0:1
Oct 01 21:46:15 server zed[1511860]: eid=23485 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:7
Oct 01 21:46:15 server zed[1511869]: eid=23486 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:642
Oct 01 21:46:15 server zed[1511876]: eid=23487 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:653
Oct 01 21:46:15 server zed[1511881]: eid=23488 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:65
Oct 01 21:46:15 server zed[1511884]: eid=23489 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:718
Oct 01 21:46:15 server zed[1511887]: eid=23490 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:673
Oct 01 21:46:15 server zed[1511892]: eid=23491 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:623
Oct 01 21:46:15 server zed[1511896]: eid=23492 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:19
Oct 01 21:46:15 server zed[1511902]: eid=23494 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:64
Oct 01 21:46:15 server zed[1511904]: eid=23493 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:719
Oct 01 21:46:15 server zed[1511905]: eid=23495 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:8
Oct 01 21:46:15 server zed[1511908]: eid=23496 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:643
Oct 01 21:46:15 server zed[1511910]: eid=23497 class=data pool='userdata' priority=2 err=5 flags=0x180 bookmark=21992:0:0:11

You are unable to access the 'corrupt' data inside the snapshot after it happens. All the other snapshots before and after are fine.

[root@server snapshot]# ls -la host backup_1hour-2024-10-01-1800
ls: cannot access 'hostbackup_1hour-2024-10-01-1800/.': Object is remote
ls: cannot access 'hostbackup_1hour-2024-10-01-1800/..': Object is remote
total 0
d????????? ? ? ? ?            ? .
d????????? ? ? ? ?            ? ..
[root@server snapshot]# ls -la hostbackup_4hour-2024-10-01-2201
total 74
dr-xr-xr-x  14 root root       24 Oct  1 00:44 .
drwxrwxrwx  40 root root        2 Oct  2 14:00 ..
-rw-r--r--   1 root root        0 Jul 14  2022 1
-rw-r--r--   1 root linksafe    0 Apr 11  2023 2
etc ...

After a reboot however I can access the data in the snapshot again. So the data isn't actually corrupt but fine.

[root@server snapshot]# ls -la host backup_1hour-2024-10-01-1800
total 74
dr-xr-xr-x  14 root root       24 Oct  1 00:44 .
drwxrwxrwx  40 root root        2 Oct  2 14:00 ..
-rw-r--r--   1 root root        0 Jul 14  2022 1
-rw-r--r--   1 root linksafe    0 Apr 11  2023 2
etc ...

Performing two scrubs after the reboot also makes the error go away and makes errors: No known data errors show again.

So it is a really annoying bug as ZFS sees data as corrupt even as it actually isn't.
Because of this issue we can't use ZFS 2.x for now with encrypted data. We still use ZFS 0.8.6 with encrypted data.
For now I would just recommend others to only use ZFS 2.x without encryption.

Just to reiterate: ZFS 0.8.6 doesn't have this issue.

@amano-kenji
Copy link

amano-kenji commented Oct 2, 2024

@J0riz If you remove dust from the computer case, does the issue go away? Dust causes electrostatic shock which flips bits in RAM. Random RAM errors can cause software errors.

After thoroughly cleaning my computer case, it seems I stopped seeing various errors.

@aerusso
Copy link
Contributor

aerusso commented Oct 2, 2024

@amano-kenji This may have been the root cause of an issue you were having, but it is unlikely that RAM errors would cause this problem in 2.x, but not cause them in 0.8.y. Also, it sounds like you may have been experiencing multiple issues (and I'd expect that people reporting here aren't experiencing a cluster of weird/buggy behavior).

I do recommend everyone seeing these problems run memtest to rule out RAM issues, though. That's far more reliable than just cleaning out dust (though it won't help allergies! :-) .

@J0riz
Copy link

J0riz commented Oct 2, 2024

Although we are getting off track:

All our (staging) systems are running in a TIer 3+ datacenter. All air is filtered and I never saw dust in our datacenter.
We use ECC memory and use rasdaemon to monitor reliability of all our RAM. We perform memtests on our staging servers regularly. If there was any hardware issue we would have known.

Just to reiterate: ZFS 0.8.6 doesn't have this issue with encrypted snapshots showing up with 'permanent errors'.
ZFS 0.8.6 has been running reliable on dozen of systems in our datacenter. Also downgrading to ZFS 0.8.6 makes this behaviour go away.
I'm not aware of some magical dedust feature in ZFS 0.8.6. That would be nice for my allergies. 🙃

Prompt: Please go back on topic.

@cyberpower678
Copy link

cyberpower678 commented Oct 2, 2024

I just want to follow up that I USED to have these issues, mainly brought on from bring an older pool to a newer ZFS where some mess was created because something in 2 didn't like something from an earlier version. I usually fixed my issue by either purging the bad snapshot that triggered the corruption using the various ZFS kernel flags that suppress errors, and performing a scrub, or simply copying the data out if I can't purge the bad snapshot, and then purging and recreating the impacted dataset. It has not resulted in and data corruption/loss for me, and the ZFS pool has been humming along without issue since. So my suspicion is that users still impacted are coming in from older versions of ZFS, and rather than devs trying to figure out every nuance for everyone, which is probably almost impossible, it's probably just easier to recreate the faulty dataset.

For clarity, I'm using encrypted datasets

@HankB
Copy link

HankB commented Oct 2, 2024

Just to reiterate: ZFS 0.8.6 doesn't have this issue with encrypted snapshots showing up with 'permanent errors'.

I've been running ZFS with native encryption on a laptop I purchased about 5 years ago. I'm not positive about the version of ZFS I started with but it might have been 0.7.x. At some point I began seeing these "permanent errors" in snapshots and suspected that the NVME SSD was beginning to fail. I purchased a Samsung 980 PRO to replace it, thinking that would likely be the most reliable device I could purchase at the time. The issues continued with the replacement. I found that if I disabled the full pool backups I had been running, the errors eventually went away as the snapshots were deleted. I have not seen this issue with the "normal" backups that just include my user files.

I've re-enabled the full pool backup occasionally to see if the problem persists. It has and when found, I disable that backup and the "permanent errors" eventually go away.

On 2024-09-23 I reinstated the full pool backups to see if "permanent errors" returned. There is now a single permanent error in the pool. The last time I did this, the pool reported over 100 errors before I disabled this backup.

I'm cautiously optimistic that the fixes reported in 2.2.5, 2.2.6 have reduced but not fully eliminated the error. Creation information for the pool is

2023-12-04.22:37:29 zpool create -o ashift=12 -o autotrim=on -O encryption=on -O keylocation=prompt -O keyformat=passphrase -O acltype=posixacl -O xattr=sa -O dnodesize=auto -O compression=lz4 -O normalization=formD -O relatime=on -O canmount=off -O mountpoint=/ -R /mnt rpool /dev/disk/by-id/nvme-HP_SSD_EX950_1TB_HBSE49202700837-part4

@phreaker0
Copy link

I'm also running 2.2.6 and still have the same issues with my encrypted pools on several servers.

It typically happens after the server is running for a couple of days and then errors will shown on the backup replication of my ssd root pool to my hdd storage pool.

This is the way I do my hourly replication currently:

#!/bin/bash

/usr/local/bin/clear-zfs-snapshot-errors.sh
/usr/sbin/syncoid --no-resume -r --skip-parent --no-clone-handling --force-delete --exclude="rpool/var/lib/docker" --sendoptions="Lce" rpool storage/backup/rpool
if [ $? -ne 0 ]; then
  /usr/local/bin/clear-zfs-snapshot-errors.sh
  /usr/sbin/syncoid --no-resume -r --skip-parent --no-sync-snap --no-clone-handling --force-delete --exclude="rpool/var/lib/docker" --sendoptions="Lce" rpool storage/backup/rpool
  code=$?
  if [ $code -ne 0 ]; then
    /usr/local/bin/clear-zfs-snapshot-errors.sh
  fi

  exit $code
fi

The script for destroying the metadata errors in the affected snapshots (if those aren't cleared the zfs replication won't work because of I/O errors):

#!/bin/bash

zpool status -v | grep ':<0x' | grep rpool | sed 's#^\s*##g' | grep '@' | sed 's#:<0x.>$##'  | xargs -n1 --no-run-if-empty zfs destroy
exit 0

If the replication fails I will get the permanents errors. An erroneous replications looks like this:

Oct 02 16:25:38 craig ssd-replication.sh[674751]: INFO: Sending incremental rpool/ROOT@autosnap_2024-09-29_19:00:24_hourly ... syncoid_craig_2024-10-02:16:25:37-GMT02:00 to storage/backup/rpool/ROOT (~ 165 KB):
Oct 02 16:27:32 craig ssd-replication.sh[674751]: INFO: Sending incremental rpool/ROOT/ubuntu@autosnap_2024-09-29_19:00:13_hourly ... syncoid_craig_2024-10-02:16:27:32-GMT02:00 to storage/backup/rpool/ROOT/ubuntu (~ 867.0 MB):
Oct 02 16:27:37 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_04:00:06_hourly': Input/output error
Oct 02 16:27:41 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_10:00:08_hourly': Input/output error
Oct 02 16:27:42 craig ssd-replication.sh[679516]: cannot receive incremental stream: most recent snapshot of storage/backup/rpool/ROOT/ubuntu does not
Oct 02 16:27:42 craig ssd-replication.sh[679516]: match incremental source
Oct 02 16:27:42 craig ssd-replication.sh[679519]: mbuffer: error: outputThread: error writing to <stdout> at offset 0x27c0000: Broken pipe
Oct 02 16:27:42 craig ssd-replication.sh[679519]: mbuffer: warning: error during output to <stdout>: Broken pipe
Oct 02 16:27:42 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_12:00:09_hourly': signal received
Oct 02 16:27:42 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_12:30:08_frequently': Broken pipe
Oct 02 16:27:42 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_12:45:01_frequently': Broken pipe
Oct 02 16:27:42 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_13:00:12_hourly': Broken pipe
Oct 02 16:27:42 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_13:00:12_frequently': Broken pipe
Oct 02 16:27:42 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_13:15:04_frequently': Broken pipe
Oct 02 16:27:42 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_13:30:07_frequently': Broken pipe
Oct 02 16:27:42 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_13:45:02_frequently': Input/output error
Oct 02 16:27:42 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-09-30_14:00:13_hourly': Broken pipe
...
Oct 02 16:27:43 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-10-02_14:00:10_hourly': Broken pipe
Oct 02 16:27:43 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-10-02_14:00:10_frequently': Broken pipe
Oct 02 16:27:43 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@autosnap_2024-10-02_14:15:03_frequently': Broken pipe
Oct 02 16:27:43 craig ssd-replication.sh[679518]: warning: cannot send 'rpool/ROOT/ubuntu@syncoid_craig_2024-10-02:16:27:32-GMT02:00': Broken pipe
Oct 02 16:27:43 craig ssd-replication.sh[679518]: cannot send 'rpool/ROOT/ubuntu': I/O error
Oct 02 16:27:43 craig ssd-replication.sh[674751]: CRITICAL ERROR:  zfs send -L -c -e  -I 'rpool/ROOT/ubuntu'@'autosnap_2024-09-29_19:00:13_hourly' 'rpool/ROOT/ubuntu'@'syncoid_craig_2024-10-02:16:27:32-GMT02:00' | mbuffer  -q -s 128k -m 16M | pv -p -t -e -r -b -s 909076296 |  zfs receive  -F 'storage/backup/rpool/ROOT/ubuntu' 2>&1 failed: 256

Running two scrubs will clear the existing errors (if the affected snapshots were destroyed before). But once errors starts showing the will only increase from here and only a reboot will make sure that errors won't show for some time.

So far I don't experienced any "real" data errors beside losing the affected snapshots.

So my suspicion is that users still impacted are coming in from older versions of ZFS, and rather than devs trying to figure out every nuance for everyone, which is probably almost impossible, it's probably just easier to recreate the faulty dataset.

I think I already tried that, but I probably will do it again to check if this may work.

@rincebrain
Copy link
Contributor

My suspicion would be that something is unsafely using some piece of metadata in the encrypted dataset being sent, at the same time as something else goes to use it, and you're getting a spurious decrypt/decompress/checksum error from that inconsistent state, and then it goes away on subsequent recheck.

But that's just a guess, it's not like I have one locally that reproduces it. It'd be useful to look at the zpool events messages to see exactly what object produced the error so we can inspect and try to reproduce it, probably.

@Maltz42
Copy link

Maltz42 commented Oct 2, 2024

I've been running ZFS with native encryption on a laptop I purchased about 5 years ago. I'm not positive about the version of ZFS I started with but it might have been 0.7.x. At some point I began seeing these "permanent errors" in snapshots and suspected that the NVME SSD was beginning to fail. I purchased a Samsung 980 PRO to replace it, thinking that would likely be the most reliable device I could purchase at the time. The issues continued with the replacement. I found that if I disabled the full pool backups I had been running, the errors eventually went away as the snapshots were deleted. I have not seen this issue with the "normal" backups that just include my user files.

It's actually pretty well established when these issues first appeared, which makes their longevity even more puzzling/concerning. Native encryption was rolled out with v0.8.0 (May 2019 - 0.8.x is probably what you started on) and the corruption issues first appeared in 2.0.0 (Late 2020). They've gotten better over time, but it's still been years that these issues have persisted in some form or other.

@rincebrain
Copy link
Contributor

It's nobody's responsibility to fix it.

There's not like, assigned areas of the project where it's so-and-so's job to fix this if it breaks, and the original company that contributed the project A) doesn't seem to hit these and B) appears to have stopped contributing some time ago.

The rest of the companies that use OpenZFS, to my knowledge, mostly don't use native encryption, so that leaves random volunteers or any exceptions, to fix these.

That's not intended as an indictment of anyone involved, it's just a statement of "nobody's responsible for making sure it gets done, so it doesn't get done if nobody is responsible for it and not enough people are in the set of {able, motivated by encountering it} to have it happen organically"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Encryption "native encryption" feature Status: Triage Needed New issue which needs to be triaged Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests