Skip to content

Exceedingly long resource (re)start times #4151

Open
@sacr1ficez

Description

@sacr1ficez

Describe the bug

After PR #3924 server started to behave slow, often throwing long execution warning & causing network trouble on resource (re)starts. It also causes server console to be lagging, or have some kind of input delay. It has never happened before with this resource, and only recently after server update i've started noticing something isn't alright. Test resource i've used has 100 MB overall, and around 426 .lua scripts, but according to others it also happens on default resources, and custom smaller systems (see additional context). What's worse, it seems to be inconsistent, sometimes you can reproduce it right away, and the other time it will randomly appear. Server running time might be a factor.

Steps to reproduce

local loadTimes = {}

function onResourceStart(startedResource)
	local diffResource = (resource ~= startedResource)

	if (not diffResource) then
		return false
	end

	local resourceName = getResourceName(startedResource)
	local savedTime = loadTimes[resourceName]

	if (not savedTime) then
		return false
	end

	local mtaVer = getVersion()
	local mtaVerSortable = mtaVer.sortable
	local timeNow = getTickCount()
	local timeDiff = (timeNow - savedTime).." ms"
	local startLog = resourceName.." took "..timeDiff.." to load @ "..mtaVerSortable

	outputDebugString(startLog)
	loadTimes[resourceName] = nil
end
addEventHandler("onResourceStart", root, onResourceStart)

function onResourceStop(stoppedResource)
	local diffResource = (resource ~= stoppedResource)

	if (not diffResource) then
		return false
	end

	local resourceName = getResourceName(stoppedResource)
	local timeNow = getTickCount()

	loadTimes[resourceName] = timeNow
end
addEventHandler("onResourceStop", root, onResourceStop)

Version

Server: r22883 and above
Windows 64 bit server

Additional context

See:
https://discord.com/channels/801330706252038164/1289708691830083775/1358180315209797673
https://discord.com/channels/801330706252038164/1289708691830083775/1358181367002959892
(MTA:SA development discord - GNN6PRtTnu)

Relevant log output

[2025-04-08 21:21:35] Stopping dayz
[2025-04-08 21:21:35] Starting dayz
[2025-04-08 21:21:37] INFO: dayz took 2342 ms to load @ 1.6.0-9.22880.0

[2025-04-08 21:26:23] Stopping dayz
[2025-04-08 21:26:23] Starting dayz
[2025-04-08 21:26:30] WARNING: Long execution (dayz)
[2025-04-08 21:26:32] INFO: dayz took 9737 ms to load @ 1.6.0-9.22883.0

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions