Skip to content

Weird crash 0x00163482 / 0x00154918 related to buildings #4496

@PlatinMTA

Description

@PlatinMTA

Describe the bug

When creating buildings you can encounter this crash. I am unable to make a reproduceable resource, but I can confirm this only happens when buildings are present and if you replace them with objects it just doesn't. I can somewhat trigger it on my own server after loading and unloading hundreds of buildings... but again this doesn't happen on a default server.

I have been encountering similar issues with this new element type since it's introduction, hence I often don't use it, even though it's more performant you are just more likely to crash after a long session.

It would be nice if we could pinpoint why this happens because I have been unable to find a solution. The server requests lots of IDs and has at least 700 custom textures loaded in memory and some other shaders, + at least 100 resources loaded. If I had to guess, having a heavy server "enables" this crash, and that's why its basically impossible to make it happen in an empty server.

Image Image

Steps to reproduce

Create and delete hundreds of buildings until you crash.

local objects = {}
local buildings = {}
local buildingsAmount = 500

local state = false
function createBuildings()
	local x, y, z = getElementPosition(localPlayer)
	local int, dim = getElementInterior(localPlayer), getElementDimension(localPlayer)
	for i=1,buildingsAmount do
		if i%4 == 0 then
			buildings[i] = createBuilding(1337, x, y+(i/4)+1, z+2)
			objects[i] = createObject(1337, x, y+(i/4)+1, z+3)
		elseif i%4 == 1 then
			buildings[i] = createBuilding(1337, x, y-(i/4)-1, z+2)
			objects[i] = createObject(1337, x, y+(i/4)+1, z+3)
		elseif i%4 == 2 then
			buildings[i] = createBuilding(1337, x+(i/4)+1, y, z+2)
			objects[i] = createObject(1337, x, y+(i/4)+1, z+3)
		else
			buildings[i] = createBuilding(1337, x-(i/4)-1, y, z+2)
			objects[i] = createObject(1337, x, y+(i/4)+1, z+3)
		end
		
		setElementData(buildings[i], "test", true, false)
		setElementData(buildings[i], "id", i)
		
		setElementFrozen(buildings[i], true)
		setElementDoubleSided(buildings[i], true)
		
		setElementInterior(buildings[i], int)
		setElementDimension(buildings[i], dim)
	end
	
	state = true
end

function destroyBuildings()
	for i=1,buildingsAmount do
		destroyElement(buildings[i])
		destroyElement(objects[i])
	end
	
	state = false
end

setTimer(function()
	if state then
		destroyBuildings()
	else
		createBuildings()
	end
end, 500, 0)

That script will make me crash in a couple of seconds on my server. Can't really reproduce it on a clean server. However, if I change the buildings for objects, the crash does not happen at all.

If you have a big gamemode, I would kindly ask you to try to run that code or something similar and let me know if you crash or not. I am just lost on what to do to make a reproduceable resource for this crash right now.

Version

Client: Multi Theft Auto v1.7-untested-25615

Additional context

No response

Relevant log output

** -- Unhandled exception -- **

Version = 1.7-untested-25615.0.000
Time = Sat Sep 27 20:28:59 2025
Module = C:\ProgramData\MTA San Andreas All\1.7\GTA San Andreas\gta_sa.exe
Code = 0xC0000005
Offset = 0x00163482

EAX=0FCB4B38  EBX=3B4C1949  ECX=00B82DD0  EDX=00000000  ESI=2444B128
EDI=00000002  EBP=00C15448  ESP=0177FD10  EIP=00563482  FLG=00010202
CS=0023   DS=002B  SS=002B  ES=002B   FS=0053  GS=002B

** -- End of unhandled exception -- **


** -- Unhandled exception -- **

Version = 1.7-untested-25615.0.000
Time = Sat Sep 27 20:52:38 2025
Module = C:\ProgramData\MTA San Andreas All\1.7\GTA San Andreas\gta_sa.exe
Code = 0xC0000005
Offset = 0x00154918

EAX=000092E8  EBX=00000000  ECX=20014081  EDX=00000001  ESI=13717160
EDI=101D5CE0  EBP=FFFDFFFF  ESP=0177FBC0  EIP=00554918  FLG=00010202
CS=0023   DS=002B  SS=002B  ES=002B   FS=0053  GS=002B

** -- End of unhandled exception -- **

Security Policy

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

Metadata

Metadata

Assignees

No one assigned

    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