Skip to content

OBS Studio silently fails to write to paths that become read-only during recordings #9665

Closed as not planned

Description

@multiplealiases

Operating System Info

Other

Other OS

NixOS 23.05

OBS Studio Version

Other

OBS Studio Version (Other)

29.0.2

OBS Studio Log URL

https://obsproject.com/logs/ROVqxc9zwoMmYLjK

OBS Studio Crash Log URL

No response

Expected Behavior

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.

  1. Mount a filesystem backed by a block device.
  2. Set OBS's recording path to wherever it's mounted and start recording.
  3. 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)
  4. 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)

Anything else we should know?

No response

Activity

  1. Fenrirthviti commented on Oct 4, 2023

    @Fenrirthviti
    Member

    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.

  2. multiplealiases commented on Oct 4, 2023

    @multiplealiases
    Author

    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-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.

  3. Fenrirthviti commented on Oct 4, 2023

    @Fenrirthviti
    Member

    Looks like this might be solved by #3459

    Testing to confirm would be welcome!

  4. multiplealiases commented on Oct 28, 2023

    @multiplealiases
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions