Page MenuHomeFeedback Tracker

thread keyword causes corruption
Assigned, UrgentPublic

Description

The following code will go into an infinite loop until all resources on the system are consumed and crash random processes on the system with out of memory errors until the game engine finally crashes. Exiting the engine does not stop the process.

void TestThread() {
	Sleep(100);
	for (int j = 0; j < 1000; ++j) {
		Print("TestThread " + j);
		Sleep(100);
	}
}
modded class DayZGame {
	void DayZGame() {
		for (int i = 0; i < 2; ++i) {
			Print("Starting TestThread " + i);
			thread TestThread();
		}
	}
}

Script log shows the following:

SCRIPT       : Registered 367 temporary action enum(s), UAN==367
SCRIPT       : ... Backlit Effects Enabled
SCRIPT       : Starting TestThread 0
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1
SCRIPT       : Starting TestThread 1

Edit:
Editing the thread to the following works correctly.

void TestThread() {
	Sleep(100);
	while(true) {
		Print("TestThread");
		Sleep(100);
	}
}

Details

Severity
Crash
Resolution
Open
Reproducibility
Always
Operating System
Windows 7
Category
General

Event Timeline

antihax created this task.Sep 5 2023, 6:17 AM
Geez changed the task status from New to Assigned.Sep 5 2023, 11:07 AM
antihax updated the task description. (Show Details)Sep 5 2023, 4:02 PM
antihax updated the task description. (Show Details)
antihax updated the task description. (Show Details)