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
{{ message }}
Repository navigation
OBS Studio silently fails to write to paths that become read-only during recordings #9665
OBS should abort the recording and warn the user that the recording path has become read-only.
Current Behavior
It will continue to "write" to a read-only filesystem; the recording appears to "continue", and screenshots can still be "taken". This seems to go on for as long as the user doesn't notice.
Additionally, on stopping, it will attempt to finalize a recording that it can't write to, forever stuck at "Stopping Recording..."
Steps to Reproduce
As far as I understand it, this bug can be triggered by any instance of the recording path being forced read-only; while these do it intentionally, the Linux kernel can forcefully remount filesystems read-only in response to I/O errors.
Mount a filesystem backed by a block device.
Set OBS's recording path to wherever it's mounted and start recording.
As root, echo 1 > /sys/block/whatever/whatever2/ro or mount -o remount,ro /mount/point (or do whatever it takes to get the kernel to force it read-only)
OBS will continue to record and will silently declare it has taken screenshots to an unwritable path. No warning of any kind is given that this is the case.
This will continue indefinitely, potentially causing the user to lose footage. (22 hours of footage, in my case)
Just my opinion, if a user explicitly sets their filesystem to read-only while OBS is active, I'm not sure this is a case we should be adding complexity to OBS to handle, if it's even possible in the first place.
The Linux kernel can force-remount filesystems read-only in response to I/O errors, so you'll see, say, EXT4-fs (sdb1): Remounting filesystem read-only in the syslog. The reproduction instructions that do it intentionally are there to model the failure mode of a filesystem being forced read-only due to I/O errors that aren't the fault of the user.
OBS can't help with the read-only filesystem but I believe it should do something in response, instead of silently going ahead with operations like recording and screenshotting, saying absolutely nothing, not to the user, not to stderr, not to the syslog, nowhere. I only noticed when I tried to stat the screenshots OBS ostensibly created, and found they did not exist.
Unfortunately, this issue doesn't seem to be solved by that PR, and worse, I don't think it's possible to fix it at OBS' or FFmpeg's level because it's a problem of the kernel.
As I understand it, the Linux kernel's page cache promises processes that it will "eventually" commit writes to disk. The problem is that when a filesystem is forced read-only, no signalling exists to notify existing processes with open file descriptors that they've just had the metaphorical rug pulled from under them, so the writes keep piling up and the "eventually" never comes. To it, it could just be a transient fault, maybe it's just a delay, maybe the disk could come back. The page cache ends up writing checks it can't cash.
This leads to the bizarre situation of watching a recording continuing to grow in size after having force-remounted the filesystem it's on read-only. Testing writeability with touch produces read-only file system, as would all the other standard methods. If you wait long enough, the kernel will run out of pages to cache with, and OBS will just hang, waiting on IO that will never come. Once you reboot, all of that is gone. The filesystem goes back to the state from right before it was force-remounted.
Activity
Fenrirthviti commentedon Oct 4, 2023
Just my opinion, if a user explicitly sets their filesystem to read-only while OBS is active, I'm not sure this is a case we should be adding complexity to OBS to handle, if it's even possible in the first place.
multiplealiases commentedon Oct 4, 2023
Oh, I only implied that. Sorry.
The Linux kernel can force-remount filesystems read-only in response to I/O errors, so you'll see, say,
EXT4-fs (sdb1): Remounting filesystem read-onlyin the syslog. The reproduction instructions that do it intentionally are there to model the failure mode of a filesystem being forced read-only due to I/O errors that aren't the fault of the user.OBS can't help with the read-only filesystem but I believe it should do something in response, instead of silently going ahead with operations like recording and screenshotting, saying absolutely nothing, not to the user, not to stderr, not to the syslog, nowhere. I only noticed when I tried to
statthe screenshots OBS ostensibly created, and found they did not exist.Fenrirthviti commentedon Oct 4, 2023
Looks like this might be solved by #3459
Testing to confirm would be welcome!
multiplealiases commentedon Oct 28, 2023
Unfortunately, this issue doesn't seem to be solved by that PR, and worse, I don't think it's possible to fix it at OBS' or FFmpeg's level because it's a problem of the kernel.
As I understand it, the Linux kernel's page cache promises processes that it will "eventually" commit writes to disk. The problem is that when a filesystem is forced read-only, no signalling exists to notify existing processes with open file descriptors that they've just had the metaphorical rug pulled from under them, so the writes keep piling up and the "eventually" never comes. To it, it could just be a transient fault, maybe it's just a delay, maybe the disk could come back. The page cache ends up writing checks it can't cash.
This leads to the bizarre situation of watching a recording continuing to grow in size after having force-remounted the filesystem it's on read-only. Testing writeability with
touchproducesread-only file system, as would all the other standard methods. If you wait long enough, the kernel will run out of pages to cache with, and OBS will just hang, waiting on IO that will never come. Once you reboot, all of that is gone. The filesystem goes back to the state from right before it was force-remounted.