[Bug 275632] process being killed which has a big file mmap'ed and performs writes to it

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 08 Dec 2023 12:42:42 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275632

            Bug ID: 275632
           Summary: process being killed which has a big file mmap'ed and
                    performs writes to it
           Product: Base System
           Version: 14.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: d8zNeCFG@aon.at

Scenario:
- FreeBSD stable/14 52369c5d29f5f, amd64
- 244 GB file on ZFS
- The file is being mmap'ed in its entirety by a program called "cawic".
- Read and write operations are performed on selected portions of this mapping
(specifically, the contents are - sequentially from the beginning to the end -
read in blocks of size 128k and some of these blocks immediately rewritten with
updated data, such that ultimately all blocks will have been read and some will
have been rewritten).

Result:
- The process is killed, with the following message in dmesg:

pid 28386 (cawic), jid 0, uid 20201, was killed: failed to reclaim memory

- Swap space was not used

Expected result:
- The process should run to completion successfully.

Notes:
- This was working correctly (i.e., the process never was killed) some time
before FreeBSD 12; with FreeBSD 12 the same issue occurred.
- The ZFS filesystem on which the file resides has compression on.
- If no blocks are ever written (all are only read), the process is not killed.

-- 
You are receiving this mail because:
You are the assignee for the bug.