after a few days, APFS stops handling writes

Originator:tim1724
Number:rdar://32994537 Date Originated:6/26/2017
Status:Duplicate/32862539 Resolved:
Product:macOS Product Version:10.13
Classification: Reproducible:
 
Summary:
Every few days, my APFS root volume starts refusing writes. dmesg shows lots of filesystem-related errors including some "No space left on device" messages, but my disk is nowhere near ull.

Steps to Reproduce:
1. Upgrade a Sierra system using a Fusion Drive to High Sierra.
2. Use it for a few days.

Expected Results:
It should not have filesystem problems

Observed Results:
After a few days apps get slow and report errors saving files.  dmesg gives me endless "fs_tx_leave:15561: tx_leave failed: 5" errors and occasionally other fs_* errors, e.g.,

fusion_rc_allocate:178: spaceman_alloc (1) failed with 28 No space left on device
fusion_rc_allocate:186: tx_leave failed with 5 Input/output error
fusion_rc_promote_stream:490: Failed to promote LBA range (0x40000046c36c8, 1), err: 28 No space left on device

This despite the fact that the filesystem has lots and lots of free space:

sequoia:~ tim$ df -h /
Filesystem     Size   Used  Avail Capacity iused               ifree %iused  Mounted on
/dev/disk2s1  2.8Ti  1.3Ti  1.6Ti    45% 4923927 9223372036849851880    0%   /

I've tried booting into single user mode and running fsck_apfs on it, but that didn't find any problems.


Note that when this occurs I _can_   usually create/modify files on the command line:
sequoia:~ tim$ echo 'Hello, world!' > hello
sequoia:~ tim$ cat hello
Hello, world!
sequoia:~ tim$ ls -l hello
-rw-r--r--  1 tim  staff  14 Jun 26 17:44 hello

But GUI apps can't save properly.  e.g., if I create a file in Pages it repeatedly tells me "The document could not be autosaved. Y our most recent changes might be lost." and it never writes the file out to disk.

I'm thinking it may be related to whatever mechanisms are used for things like autosave and local time machine, but I haven't really had time to dig into it. Hopefully the attached sysdiagnose will help.

I've also had some problems with Time Machine (to an external Thunderbolt 2 drive) failing with "unable to create folder" ... I don't know whether it's an unrelated bug or whether it has something to do with my filesystem problem.  (When I find time I'll write a separate bug report for that.)

Version:
10.13/17A291j (but it occurred on the previous developer seed as well)

Notes:
I've seen some weird problems on my iPhone 6 running iOS 11 (particularly in the first developer seed) that suggests to me that it might also have similar filesystem issues.

Configuration:
iMac (Retina 5K, 27-inch, Late 2014)
3TB Fusion Drive

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!