citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.57k stars 2.11k forks source link

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

Open DurtyFree opened 2 months ago

DurtyFree commented 2 months ago

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;

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

slashkeyvalue commented 2 months ago

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

DurtyFree commented 2 months ago

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

MLV-Paul commented 2 months ago

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.

FelixDE commented 2 months ago

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.

Legacy-TacticalGamingInteractive commented 2 months ago

+1

grzybeek commented 2 months ago

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

slashkeyvalue commented 2 months ago

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

LemonzPCMR commented 2 months ago

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

slashkeyvalue commented 2 months ago

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.

keiraskyler commented 2 months ago

Exact same problem.

Cockers96 commented 1 month ago

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

spacevx commented 1 month ago

@prikolium-cfx

DurtyFree commented 1 month ago

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

talonlzr commented 1 month ago

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.

Legacy-TacticalGamingInteractive commented 1 month ago

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

slashkeyvalue commented 1 month ago

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

Mytic2330 commented 1 month ago

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?

atorres112 commented 2 days ago

has anyone had luck on fixing this?

DurtyFree commented 2 days ago

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