Requesting Help with `txg_sync` Error I Can't Diagnose
First, before this rather large infodump, I want to thank anyone that takes the time to read through this to offer any information or advice on trying to resolve this issue.
Here’s the issue I’ve been struggling with.
I keep getting this error on my server:
INFO: task txg_sync:1615 blocked for more than 241 seconds.
Tainted: P O 5.15.0-112-generic #122-Ubuntu
Background:
I’ve got a homeserver running Ubuntu server 22.04 (no DE) with an Intel Core i7-6700K CPU @ 4.00GHz, 32GB RAM, and two ZFS pools. The OS is installed on its own 128GB SSD, and the two ZFS pools consist of a 128GB SSD in its own pool for the server’s cache, and a 4x8TB HDD RAIDZ1 pool that is my main data/server storage (much more detailed system info below).
I have a bunch of services running in Docker containers, and overall everything is great, except for when that error rears up.
The error seems random, but occurs most reliably, but not consistently, when I’m trying to write larger media files to the RAIDZ1 pool. I am aware that this an IOPS issue, but so far I have not been able to diagnose it.
Back in February, I was carrying some boxes down to the basement where the server rack is, and I accidentally kicked a stool into the server which knocked the shit out of it (it’s a tower pc that I built back in 2016 or 2017 and repurposed in 2020ish to server use). When I turned on the monitor it was in total panic mode. The screen was gibberish colors and flickering madness.
I had to force shutdown with the power button. I waited a good couple of minutes, and on reboot, everything seemed fine. Until I noticed the new txg_sync
error a week or so later when I went down to add some media to the server.
After a lot of searching and reading that didn’t turn up pertinent info, I ran across a comment that said this error is almost always hardware related. Like a loose connection or a failing disk or something. With me having knocked the shit out of the server, I realized I should have opened the case up and checked it all out. I shut it down, opened it up, and found a loose connector on the motherboard. I reseated it, checked everything else (though not thoroughly enough, which we’ll get to), and rebooted hoping I had found the problem.
It seemed fine for a bit, but no luck. The error returned.
More searching with no luck, and then about a month ago, a friend he suggested I check all the SATA connectors by disconnecting each one and reconnecting to insure a good, solid connection. I had previously checked if they were seated when I opened the case, but didn’t disconnect and reconnect. While doing this, I found a SATA cable with a busted clip and thought again I had found the problem. I replaced the cable, and went about a week before the error resurfaced.
It continues to occur, as I mentioned inconsistently. Most reliably, but not always, when writing data to the RAIDZ1 pool.
I have run a thorough memtest, and there were no errors or issue with the RAM, and as far as I can tell, there are no errors/failures with the HDDs.
Below is a lot of system info, and an example of what I find in dmesg
for the error.
System Info
OS & Kernel
Ubuntu 22.04.4 LTS
Linux [redacted user] 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
CPU
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Vendor ID: GenuineIntel
Model name: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
CPU family: 6
Model: 94
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
Stepping: 3
CPU max MHz: 4200.0000
CPU min MHz: 800.0000
BogoMIPS: 7999.96
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dno wprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
Caches (sum of all):
L1d: 128 KiB (4 instances)
L1i: 128 KiB (4 instances)
L2: 1 MiB (4 instances)
L3: 8 MiB (1 instance)
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-7
Vulnerabilities:
Gather data sampling: Vulnerable: No microcode
Itlb multihit: KVM: Mitigation: VMX unsupported
L1tf: Mitigation; PTE Inversion
Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Meltdown: Mitigation; PTI
Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Retbleed: Mitigation; IBRS
Spec rstack overflow: Not affected
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not
affected; BHI Not affected
Srbds: Mitigation; Microcode
Tsx async abort: Mitigation; TSX disabled
RAM
Memory Device
Array Handle: 0x004A
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 8 GB
Form Factor: DIMM
Set: None
Locator: DIMM_A2
Bank Locator: BANK 1
Type: DDR4
Type Detail: Synchronous
Speed: 2133 MT/s
Manufacturer: Corsair
Serial Number: 00000000
Asset Tag: 9876543210
Part Number: CMK16GX4M2A2400C16
Rank: 2
Configured Memory Speed: 2133 MT/s
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: 1.2 V
Handle 0x004D, DMI type 17, 40 bytes
Memory Device
Array Handle: 0x004A
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 8 GB
Form Factor: DIMM
Set: None
Locator: DIMM_B1
Bank Locator: BANK 2
Type: DDR4
Type Detail: Synchronous
Speed: 2133 MT/s
Manufacturer: Corsair
Serial Number: 00000000
Asset Tag: 9876543210
Part Number: CMK16GX4M2A2400C16
Rank: 1
Configured Memory Speed: 2133 MT/s
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: 1.2 V
Handle 0x004E, DMI type 17, 40 bytes
Memory Device
Array Handle: 0x004A
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 8 GB
Form Factor: DIMM
Set: None
Locator: DIMM_B2
Bank Locator: BANK 3
Type: DDR4
Type Detail: Synchronous
Speed: 2133 MT/s
Manufacturer: Corsair
Serial Number: 00000000
Asset
Disks
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 63.9M 1 loop /snap/core20/2264
loop1 7:1 0 63.9M 1 loop /snap/core20/2318
loop2 7:2 0 87M 1 loop /snap/lxd/27948
loop3 7:3 0 87M 1 loop /snap/lxd/28373
loop4 7:4 0 38.7M 1 loop /snap/snapd/21465
loop5 7:5 0 38.8M 1 loop /snap/snapd/21759
sda 8:0 0 223.6G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 221.6G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 100G 0 lvm /
sdb 8:16 0 223.6G 0 disk
├─sdb1 8:17 0 223.6G 0 part
└─sdb9 8:25 0 8M 0 part
sdc 8:32 0 7.3T 0 disk
├─sdc1 8:33 0 7.3T 0 part
└─sdc9 8:41 0 8M 0 part
sdd 8:48 0 7.3T 0 disk
├─sdd1 8:49 0 7.3T 0 part
└─sdd9 8:57 0 8M 0 part
sde 8:64 0 7.3T 0 disk
├─sde1 8:65 0 7.3T 0 part
└─sde9 8:73 0 8M 0 part
sdf 8:80 0 7.3T 0 disk
├─sdf1 8:81 0 7.3T 0 part
└─sdf9 8:89 0 8M 0 part
ZFS
version
zfs-2.1.5-1ubuntu6~22.04.4
zfs-kmod-2.1.5-1ubuntu6~22.04.3
list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
srvrcache 222G 13.8G 208G - - 17% 6% 1.00x ONLINE -
srvrpool 29.1T 17.5T 11.6T - - 1% 60% 1.00x ONLINE -
status
pool: srvrcache
state: ONLINE
status: Some supported and requested features are not enabled on the pool.
The pool can still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(7) for details.
scan: scrub repaired 0B in 00:00:35 with 0 errors on Sun Jun 9 00:24:36 2024
config:
NAME STATE READ WRITE CKSUM
srvrcache ONLINE 0 0 0
sdb ONLINE 0 0 0
errors: No known data errors
pool: srvrpool
state: ONLINE
status: Some supported and requested features are not enabled on the pool.
The pool can still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(7) for details.
scan: scrub repaired 0B in 11:41:27 with 0 errors on Sun Jun 9 12:05:31 2024
config:
NAME STATE READ WRITE CKSUM
srvrpool ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
sdd ONLINE 0 0 0
sde ONLINE 0 0 0
sdf ONLINE 0 0 0
sdc ONLINE 0 0 0
errors: No known data errors
iostat
capacity operations bandwidth
pool alloc free read write read write
---------- ----- ----- ----- ----- ----- -----
srvrcache 13.8G 208G 0 22 48.0K 291K
sdb 13.8G 208G 0 22 48.0K 291K
---------- ----- ----- ----- ----- ----- -----
srvrpool 17.5T 11.6T 33 59 2.14M 1.03M
raidz1-0 17.5T 11.6T 33 59 2.14M 1.03M
sdd - - 8 15 554K 275K
sde - - 7 13 536K 252K
sdf - - 8 15 562K 275K
sdc - - 8 14 539K 252K
---------- ----- ----- ----- ----- ----- -----
PCI
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
00:14.0 USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller (rev 31)
00:16.0 Communication controller: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 (rev 31)
00:17.0 SATA controller: Intel Corporation Q170/Q150/B150/H170/H110/Z170/CM236 Chipset SATA Controller [AHCI Mode] (rev 31)
00:1b.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #17 (rev f1)
00:1c.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #1 (rev f1)
00:1d.0 PCI bridge: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #9 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Z170 Chipset LPC/eSPI Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller (rev 31)
00:1f.3 Audio device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller (rev 31)
00:1f.4 SMBus: Intel Corporation 100 Series/C230 Series Chipset Family SMBus (rev 31)
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (2) I219-V (rev 31)
01:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 3GB] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP106 High Definition Audio Controller (rev a1)
03:00.0 USB controller: ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller
dmesg
[321540.060243] INFO: task txg_sync:1615 blocked for more than 120 seconds.
[321540.060330] Tainted: P O 5.15.0-112-generic #122-Ubuntu
[321540.060408] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[321540.060495] task:txg_sync state:D stack: 0 pid: 1615 ppid: 2 flags:0x00004000
[321540.060498] Call Trace:
[321540.060500] <TASK>
[321540.060502] __schedule+0x24e/0x590
[321540.060509] schedule+0x69/0x110
[321540.060512] schedule_timeout+0x87/0x140
[321540.060515] ? zio_issue_async+0x12/0x20 [zfs]
[321540.060653] ? __bpf_trace_tick_stop+0x20/0x20
[321540.060657] io_schedule_timeout+0x51/0x80
[321540.060661] __cv_timedwait_common+0x12c/0x170 [spl]
[321540.060669] ? wait_woken+0x70/0x70
[321540.060672] __cv_timedwait_io+0x19/0x20 [spl]
[321540.060679] zio_wait+0x116/0x220 [zfs]
[321540.060799] dsl_pool_sync+0xb6/0x400 [zfs]
[321540.060890] ? __mod_timer+0x214/0x400
[321540.060894] spa_sync_iterate_to_convergence+0xe0/0x1f0 [zfs]
[321540.060997] spa_sync+0x2dc/0x5b0 [zfs]
[321540.061098] txg_sync_thread+0x266/0x2f0 [zfs]
[321540.061206] ? txg_dispatch_callbacks+0x100/0x100 [zfs]
[321540.061314] thread_generic_wrapper+0x61/0x80 [spl]
[321540.061324] ? __thread_exit+0x20/0x20 [spl]
[321540.061332] kthread+0x127/0x150
[321540.061336] ? set_kthread_struct+0x50/0x50
[321540.061339] ret_from_fork+0x1f/0x30
[321540.061344] </TASK>
Thank you again to anyone who takes the time to offer any info or advice on resolving this.
I mean general advice with potential hardware issues is remove as much hardware as possible, and see if the problem still exists. If it does, swap components one-by-one until you find the faulty component.
Since this seems to a sporadic problem, it would probably help to try find a way to trigger the problem more reliably. Maybe write a script that writes random files constantly, or something like that.
Iotop will help you figure out what process is causing zfs to timeout when syncing.