fivem icon indicating copy to clipboard operation
fivem copied to clipboard

RAGE error: ERR_MEM_MULTIALLOC_FREE crash when hitting cloth ped alternate variations limit

Open DurtyFree opened this issue 1 year ago • 18 comments

What happened?

My Cloth Tool received some new features in its recent update, properly utilizing the R* Cloth "Ped Alternate Variations" feature (pedalternatevariations.meta). This file basically defines a set of alternate models (YDD) per clothing that will applied when a certain other cloth is weared/applied on the ped. R* uses this for all sorts of things but the most common one is for hairs to not glitch thru clothes that cover the head, like for example big masks and hoodies.

When now generating a cloth resource that properly creates all the alternate definitions for berds (big masks) or jbibs (hoodies) the game will crash. The reason for the crash is a internal game limit that is hardcoded to 160 ped alternate variations per cloth, this limit is not related to the technical limitation of what is possible and seems like some console gen related limit. In theory this should be very easily patchable. Increasing this limit to 512 should be already more than enough.

Why increasing it and not keep it the way it is? Every server that wants to utilize proper handling of hairs/not glitching thru their clothes will come across this issue very quickly. In before most people didn't knew how to properly use this feature or it was to inconvenient to use but now it is easily accessible and I am already getting tons of reports with this crash.

Here is some quick maths to showcase the limits;

  • R* currently has about 81 hairs
  • Adding one new big mask with remove hairs feature, requires to add one ped alternation variation data for each hair to basically define that each hair uses an alternate model to remove the hairs when this particular big mask is worn. Thats 81 alternate variations already.
  • This leaves us with 79 own addon hairs in this case, so basically when we add 79 own hair styles (yes many server have this many hair styles) we already reached the limit. This is currently very possible
  • Additionally this scales up very quickly as the ped alternate variations on each hair style are also counted afaik

Feel free to reach out to me on Discord @DurtyFree for more information if needed.

Expected result

Loads the cloth alternate variations properly without game crash

Reproduction steps

  1. Create or have cloth resource with a lot of clothing, each defining ped alternate variations for basegame clothes and more
  2. Apply any of the clothes with too many ped alternate variations on it (for example some berd or jbib)
  3. Game will crash

For any cloth resource and detailed steps on how to reproduce it feel free to DM me (I don't want and also can't upload 2GB of cloth resource here)

Importancy

Crash

Area(s)

FiveM

Specific version(s)

FiveM 9654, Server 7290 Windows

Additional information

Some crashes on b3095 7cWgAVuPgt

[Window Title]
Error GTA5_b3095.exe!sub_141306B24 (0x52)

[Main Instruction]
RAGE error: ERR_MEM_MULTIALLOC_FREE

[Content]
A game error (at 0000000141306b76) caused the game to stop working.
Game memory error. Please reboot and restart the game.

[Expanded Information]
Report ID: si-e2043c39136746dc80bc30a254bc1f70

CfxCrashDump_2024_08_30_09_35_04.zip

[Window Title]
Error GTA5_b3095.exe!sub_141306B24 (0x52)

[Main Instruction]
RAGE error: ERR_MEM_MULTIALLOC_FREE

[Content]
A game error (at 0000000141306b76) caused the game to stop working.

Game memory error. Please reboot and restart the game.

[Expanded Information]
Report ID: si-6daf61a06e0e499197556f9447643a9d
[Window Title]
Error GTA5_b3095.exe!sub_141306B24 (0x52)

[Main Instruction]
RAGE error: ERR_MEM_MULTIALLOC_FREE

[Content]
A game error (at 0000000141306b76) caused the game to stop working.
Game memory error. Please reboot and restart the game.

[Expanded Information]
Report ID: si-db255086d4fc4a99aea892db6cdcb015

CfxCrashDump_2024_08_30_09_52_01.zip

DurtyFree avatar Aug 30 '24 10:08 DurtyFree

Hi, could you include a resource to easily reproduce the crash?

slashkeyvalue avatar Aug 30 '24 12:08 slashkeyvalue

Hi, could you include a resource to easily reproduce the crash?

Hi due to copyright reasons and the size of such a resource (2GB+) I can hardly upload it here but feel free to DM me at Discord @DurtyFree and I am happy to provide it privately

DurtyFree avatar Aug 30 '24 13:08 DurtyFree

We are a server with an average of 250-300 players.

We have exactly this problem, as addressed here by DurtyFree.

For this reason, we would also like to see improvements made here so that the problem can be resolved quickly.

MLV-Paul avatar Aug 30 '24 13:08 MLV-Paul

Hey, we also have this problem. Especially when players go through pieces of clothing they get the crash with the error message that DurtyFree send above.

FelixDE avatar Aug 30 '24 14:08 FelixDE

I think the same or similar was already reported years ago here https://forum.cfx.re/t/native-setpedcomponentvariation-0x262b14f48d29de80/2108253

There is repro resource attached (I believe it was for 1604 back then 😅), it was even fixed for a while but removed because it caused more issues. https://github.com/citizenfx/fivem/blob/master/code/components/gta-streaming-five/src/CrashFixes_Clothing.cpp

grzybeek avatar Sep 01 '24 15:09 grzybeek

I was able to increase the limit to 512 without any noticiable issues while testing

I'm guessing that other fix attempt was missing patches in some other places and that's why it was causing weird crashes

slashkeyvalue avatar Sep 01 '24 22:09 slashkeyvalue

I was able to increase the limit to 512 without any noticiable issues while testing

I'm guessing that other fix attempt was missing patches in some other places and that's why it was causing weird crashes

You possibly sharing this fix? I would love to testing it on a live server

LemonzPCMR avatar Sep 04 '24 23:09 LemonzPCMR

Unfortunately this is not something you would be able to test on a live server.

The patch is done but it requires some other fix to prevent crashing players that don't yet have the patch.

slashkeyvalue avatar Sep 04 '24 23:09 slashkeyvalue

Exact same problem.

keiraskyler avatar Sep 06 '24 19:09 keiraskyler

Hoping the Cfxre team looks into and implements this

TayMcKenzieNZ avatar Sep 23 '24 11:09 TayMcKenzieNZ

Hope this is looked into and fixed as a priority as yesterday alone in the space of 6 hours we had nearly 200 crashes with the errors reported above which isnt ideal for a server owner or players of the server

Cockers96 avatar Sep 24 '24 20:09 Cockers96

Afaik @slashkeyvalue already implemented a fix and its just waiting for some other changes to be published before being merged.

Maybe CFX team can confirm and provide more information

DurtyFree avatar Sep 24 '24 20:09 DurtyFree

Another 2-300 concurrent players server here, Project NXT. We are also fighting this issue, and stand with Alexander here (@DurtyFree).

A giant +1 from us. This is quickly becoming one of the most limiting factors in growing and increasing the quality our content to our end users.

talonlzr avatar Oct 15 '24 12:10 talonlzr

Afaik @slashkeyvalue already implemented a fix and its just waiting for some other changes to be published before being merged.

Maybe CFX team can confirm and provide more information

I believe it usually takes 5-6 weeks or so before fixes get pushed to Release build on average? Correct me if I'm wrong @Nobelium-cfx

There has been no push or commit to fix this issue yet.

I do have a working prototype for it but haven't had the time to actually finish it and can't promise I will be able to in the near future.

Maybe someone else from Cfx manages to fix it before i do

slashkeyvalue avatar Oct 16 '24 03:10 slashkeyvalue

There has been no push or commit to fix this issue yet.

I do have a working prototype for it but haven't had the time to actually finish it and can't promise I will be able to in the near future.

Maybe someone else from Cfx manages to fix it before i do

Could you share what you have achived so far?

Mytic2330 avatar Oct 20 '24 15:10 Mytic2330

has anyone had luck on fixing this?

atorres112 avatar Nov 17 '24 19:11 atorres112

has anyone had luck on fixing this?

There is no way in fixing this yourself. Will most likely have to wait until someone creates a PR to fix this as CFX doesn't seem to care about this

DurtyFree avatar Nov 18 '24 09:11 DurtyFree

im getting the same issues.. i packed a girls pack and didnt do anything for their hair because why would you.. but i have made those settings so hair works with hats and im getting game crashes at random, i have optimized the hell out of this pack the best i can and the total size is 3.5gig with about 4500 files... nothing is over the 128 limit as well..

hope i can get some help on this as i have worked on these packs for weeks..

Skewwy avatar Dec 26 '24 16:12 Skewwy

Is this still an issue? About to do a big EUP update with DurtyCloth and want to kinda plan ahead.

Is this still an issue? About to do a big EUP update with DurtyCloth and want to kinda plan ahead.

Yes it still is but DCT provides options to shrink the possibility of it occuring, with the trade off some game clothing mechanics

DurtyFree avatar Jan 26 '25 21:01 DurtyFree

@DurtyFree Is there something that changed with DurtyCloth in recent updates that changed how packs were generated, even with ped alternates disabled? We returned back to our old clothing packs, removed all extra generated metadata files in our clothing packs, and we're still getting massive rates of this crash, same game build, same clothing items, only difference is the version of DurtyClothTool.

jellyton255 avatar Jan 27 '25 23:01 jellyton255

@DurtyFree Is there something that changed with DurtyCloth in recent updates that changed how packs were generated, even with ped alternates disabled? We returned back to our old clothing packs, removed all extra generated metadata files in our clothing packs, and we're still getting massive rates of this crash, same game build, same clothing items, only difference is the version of DurtyClothTool.

Try to reproduce this issue just with the cloth resource and nothing else. Because its not an issue only caused by clothes

With "ped alternates disabled" it should create as much (and in some cases even less) entries as before.

DurtyFree avatar Jan 28 '25 10:01 DurtyFree

@DurtyFree Is there something that changed with DurtyCloth in recent updates that changed how packs were generated, even with ped alternates disabled? We returned back to our old clothing packs, removed all extra generated metadata files in our clothing packs, and we're still getting massive rates of this crash, same game build, same clothing items, only difference is the version of DurtyClothTool.

Try to reproduce this issue just with the cloth resource and nothing else. Because its not an issue only caused by clothes

With "ped alternates disabled" it should create as much (and in some cases even less) entries as before.

We did two separate tests today, one like you said with just clothing resources, no measured decrease in the crash rate, and then we did an update to the packs, where we added a chunk (~30 total) of standard clothing with no metadata, just plain clothing, and the crash rate increased quite a bit.

jellyton255 avatar Jan 29 '25 06:01 jellyton255

This is becoming out of control can we get a fix please Rockstar

xodashy avatar Feb 24 '25 06:02 xodashy

This seriously should be higher priority.

LemonzPCMR avatar Feb 24 '25 06:02 LemonzPCMR

Is this easy to solve by increasing a pool size in the gameconfig.xml or is a hardcoded size?

Edit: sorry I didnt properly read the issue.

DaniGP17 avatar Feb 24 '25 06:02 DaniGP17

It is unfortunate and makes buying more EUP rather pointless if we are all unable to add more with this limitation.

I see @prikolium-cfx deferred it. Suppose we will just have to wait gents. I am not going to be a downer about any future commits to the project. Because I have seen several being made still by some contributors... hopefully this gets priority as its been several months now and its such a limiting issue.

Because I have seen several being made still by some contributors... hopefully this gets priority as its been several months now and its such a limiting issue.

Do you have reproduction steps for this?

DaniGP17 avatar Feb 24 '25 08:02 DaniGP17