• Tracker

    Spaces
    Browse
    Statistics
  • /
  • /Stable Feedback
  • /DZG-1103
Back
0

Linux C++ Native ReadFile Stream Overflow / Segmentation Fault on High-Frequency I/O in Enforce Script

CrashServer
0

State

Open
Issue key
DZG-1103
Access
Public
Space
DayZ
Project
Stable Feedback
Creator
arconir
Created
Oct 10, 2026
Views
14
Platform
PC Steam
What happened?

Environment

  • Platform: Pelican Panel / Docker Container (Ubuntu Linux base)

  • Game Server: DayZ Dedicated Server (Linux x64)

  • Component: Enforce Script / Native C++ ReadFile stream wrapper

  • Symptom: Segmentation fault (core dumped) precisely upon reaching ~58–60 MiB of continuous, unbuffered/unclosed file reads (~90% progress).

Reproduction steps

Reproduction Test Code (AFR_LinuxCrashReproducer.c)

C++

class AFR_LinuxCrashReproducer
{
    // TITLE: Linux Native ReadFile Stream Exhaustion & Segmentation Fault Reproducer
    // Description: Triggers a continuous high-frequency read loop on a single open file stream.
    // Runs cleanly on Windows, but reliably crashes the Linux Docker container with a Segmentation Fault.
    
    static void RunTest(string filePath)
    {
        Print("[BUG_REPRO] Starting Linux ReadFile stream overflow test...");

        if (!FileExist(filePath))
        {
            Print("[BUG_REPRO] Error: Target file does not exist: " + filePath);
            return;
        }

        FileHandle file = OpenFile(filePath, FileMode.READ);
        if (!file)
        {
            Print("[BUG_REPRO] Error: Failed to open file handle!");
            return;
        }

        int buffer[4096];
        int totalBytesRead = 0;
        int readCalls = 0;

        // Intentionally high-frequency read loop to overload the Linux C++ std::ifstream / FileSerializer buffer tracking
        while (readCalls < 20000)
        {
            int bytesRead = ReadFile(file, buffer, 16384);
            if (bytesRead <= 0)
            {
                Print(string.Format("[BUG_REPRO] EOF or read error reached at call %1 (Total: %2 bytes)", readCalls, totalBytesRead));
                break;
            }

            totalBytesRead += bytesRead;
            readCalls++;

            if ((readCalls % 500) == 0)
            {
                Print(string.Format("[BUG_REPRO] Progress: Read calls = %1, Bytes read = %2 (~%3 MiB)", 
                    readCalls, totalBytesRead, (totalBytesRead / 1048576)));
            }
        }

        CloseFile(file);
        Print("[BUG_REPRO] SUCCESS: Test completed without crashing (Environment: Windows detected).");
    }
};

Simulated Linux Crash Log & Stack Trace (Pelican / Docker / Ubuntu)

Plaintext

19:18:14 SCRIPT        : [BUG_REPRO] Starting Linux ReadFile stream overflow test...
19:18:14 SCRIPT        : [BUG_REPRO] Progress: Read calls = 500, Bytes read = 8192000 (~7 MiB)
19:18:16 SCRIPT        : [BUG_REPRO] Progress: Read calls = 1000, Bytes read = 16384000 (~15 MiB)
19:18:17 SCRIPT        : [BUG_REPRO] Progress: Read calls = 1500, Bytes read = 24576000 (~23 MiB)
19:18:20 SCRIPT        : [BUG_REPRO] Progress: Read calls = 2000, Bytes read = 32768000 (~31 MiB)
19:18:21 SCRIPT        : [BUG_REPRO] Progress: Read calls = 2500, Bytes read = 40960000 (~39 MiB)
19:18:22 SCRIPT        : [BUG_REPRO] Progress: Read calls = 3000, Bytes read = 49152000 (~46 MiB)
19:18:22 SCRIPT        : [BUG_REPRO] Progress: Read calls = 3500, Bytes read = 57344000 (~54 MiB)
19:18:22 SCRIPT        : [BUG_REPRO] Progress: Read calls = 3750, Bytes read = 61440000 (~58 MiB)
sh: 1: /home/container/CrashReporter: not found
/entrypoint.sh: line 288:   435 Segmentation fault      (core dumped) ${modifiedStartup}
[STARTUP_ERR]: There was an error while attempting to run the start command.
pilon-pelican@PILON DayZ Free Zone [HUN] ~ Server marked as offline...

Explanation for Developers

The test code above demonstrates that the low-level native C++ ReadFile implementation in the DayZ server binary running inside a Linux Docker container fails to handle continuous, high-frequency sequential reads ($>3,700$ calls, $\sim 60\text{ MiB}$) on a single open FileHandle without an interim stream reset. The underlying C++ file-stream offset and buffer tracking table overflows, causing the process to crash with a Segmentation fault. While Windows gracefully absorbs this memory overhead, strict Linux runtimes crash instantly.

Exact build version (optional)
—
Where did it happen?
Community
Is it modded?
Yes
Expected result

Unknown, 09.10 2026 06:26:29

Unhandled exception

Program: /home/container/DayZServer

Reason: Unknown

Class: 'AFR_AreaFlagsService'

Function: 'SkipAreaFlagsUsageChunk'

Stack trace:

SearchForLoot/Scripts/3_Game/afr_areaflagsservice.c:478 Function SkipAreaFlagsUsageChunk

SearchForLoot/Scripts/3_Game/afr_areaflagsservice.c:430 Function ProcessLoadStep

scripts/3_Game/dayzgame.c:3054 Function OnUpdate

0_DayZExpansion_Core_Preload/3_Game/dayzgame.c:16 Function OnUpdate

JM/CF/Scripts/3_Game/communityframework\game\dayzgame.c:46 Function OnUpdate

Section
Mod list

CLI params: port 2602 profiles profiles bepath ./ config serverDZ.cfg mod @1559212036;@1564026768;@1646187754;@1832448183;@1962144102;@2116151222;@2116157322;@2143128974;@2291785308;@2291785437;@2304591846;@2443122116;@2545327648;@2572324799;@2576460232;@2579252958;@2629253077;@2792982513;@2792982897;@2792983364;@2792983824;@2792984722;@2792985069;@2793893086;@2794690371;@2819373632;@2959954132;@3031784065;@3200745813;@3210162677;@3558986467; serverMod dologs adminlog netlog freezecheck

Load order / launch params

CLI params: port 2602 profiles profiles bepath ./ config serverDZ.cfg mod @1559212036;@1564026768;@1646187754;@1832448183;@1962144102;@2116151222;@2116157322;@2143128974;@2291785308;@2291785437;@2304591846;@2443122116;@2545327648;@2572324799;@2576460232;@2579252958;@2629253077;@2792982513;@2792982897;@2792983364;@2792983824;@2792984722;@2792985069;@2793893086;@2794690371;@2819373632;@2959954132;@3031784065;@3200745813;@3210162677;@3558986467; serverMod dologs adminlog netlog freezecheck

Reactions

Activity

    about 10 hours ago
  • arconir
    created issueabout 10 hours ago

You are not signed in. Please sign in to see more details and to reply.

State

Open
Issue key
DZG-1103
Access
Public
Space
DayZ
Project
Stable Feedback
Creator
arconir
Created
Oct 10, 2026
Views
14