Reparenting the parent of an AudioEmitter to nil produces an unpleasant lag spike.

When reparenting the parent of an AudioEmitter to nil, it produces a spike in frame time.
Reproduction File: Upon clicking the button, the AudioEmitter is initialized on the client under the AudioSource Part. After which, the part is reparented to nil 0.5 seconds later on the Server.
repro_lag.rbxl (58.0 KB)

Video:

1 Like

Hey @fireys – I was not able to reproduce this, but we might be using different hardware – could you provide some system information? Also, is there anything interesting in the microprofiler around the time of the lag spike?

Hi there, here is my system information and a screenshot of the micro profiler:

  • AMD Ryzen 7 3700x 8-Core Processor
  • 16.0 GB Memory
  • NVIDIA GeForce RTX 2070 SUPER

MicroProfiler:

I am experiencing the same issue

System details:
OS: Windows 10
CPU: AMD Ryzen 5 5500
GPU: NVIDIA GeForce RTX 3060

Microprofiler dump
microprofile-20250409-194445.html (2.3 MB)

Interesting! Does this happen in the client too, or just Studio?

This happens whenever the part gets parented to nil; regardless whether it is done from the server or the client

This also happens in a live game

Microprofiler dump from live game:
microprofile-20250409-210039.html (8.1 MB)

This bug does not occur in the client, Just in studio as far as I’m aware.

More context for the case I am experiencing:


Same “Sound” label as the one in the microprofiler dump causing a lag spike. Footage from a live roblox server.

@fireys @crenbowo there have been several fixes in this area, does this still occur for you?

Hi there, revisiting the same repro file posted above; I am still experiencing this issue in Studio.
Here is my microprofiler log from studio:
microprofile-20250702-215913.html (2.4 MB)

Having the same issue with the repro file, where “Write Marshalled” causes a massive lag spike.
Microprofiler dump: microprofile-20250703-005410.html (2.6 MB)

Live game still experienced a lag spike when parenting the boombox prop out of workspace.
Microprofiler dump: microprofile-20250703-010029.html (5.6 MB)
Live server video:

Hi @crenbowo – the Sound job is responsible for periodic/per-frame updates like ticking AudioPlayer.TimePosition & tracking the panning changes from Emitters & Listeners – the Write Marshalled times have to do with modifying properties/attributes in the DataModel – I believe these are two separate performance problems.

The Write Marshalled spikes didn’t occur for me when I tried the provided placefile, and @fireys mentioned they only happen in studio

Do the Write Marshalled spikes occur in your live experience too? Or only studio?

At any rate – do you have a link to the place? I can try it out to see if I hit the same performance issues

1 Like

I have sent a private message regarding this bug

Sharing what I wrote in DMs in case it’s relevant for others –

After you delete (i.e. reparent-to-nil) a Sound or an AudioPlayer, it causes the audio engine to unload its file/asset. The unloading process can be sort of slow, so we do the cleanup in a background thread (which is the Thread - Background scope in the microprofiler here)

But in @crenbowo’s case, the background cleanup blocks other parts of the audio engine (this is a bug), which is why the Sound scope happening concurrently takes such a long time (it has to wait for the background cleanup to finish)

This appears to be separate from the original report about long Write Marshalled times, and it would not be specific to AudioPlayer (since Sound does the same background-unloading) but nonetheless it’s a legit issue that we’re looking into.

It doesn’t seem to lag when deleting any asset, it mainly affects certain audio files. So if you avoid deleting Sounds or AudioPlayers that have loaded those, it would avoid those frame spikes – that’s not a great solution for keeping memory under control, but it might be the best temporary-workaround until we get this fixed.

1 Like