Skip to content

Heap corruption from unsafeForcedSync in diarizer pipeline (iOS 26.4) #528

@EcoeOS

Description

@EcoeOS

Environment

  • iOS 26.4.1 (Build 23E254)
  • Device: arm64, chip=V57AP, cores=6/6, mem=7.49 GB
  • FluidAudio commit: 044bb0b
  • Swift 6 strict concurrency enabled

Bug

During live diarization sessions using SpeakerGate (with a saved voice print loaded via DiarizerModels + EmbeddingExtractor), we observe repeated warnings followed by an eventual heap corruption crash:

Warnings (every audio buffer)

Potential Structural Swift Concurrency Issue: unsafeForcedSync called from Swift Concurrent context.

Crash (intermittent, on FluidAudio's internal serial queue)

Thread 40: EXC_BREAKPOINT (code=1, subcode=0x...)
libsystem_malloc.dylib`_xzm_xzone_malloc_from_freelist_chunk.cold.1:
  "BUG IN CLIENT OF LIBMALLOC: memory corruption of free block"

The crash is on a FluidAudio-internal serial queue (not our code's queue). The unsafeForcedSync warnings suggest a Swift Concurrency data race inside FluidAudio that corrupts the heap over time.

Reproduction

  1. Initialize DiarizerModels.download() + SpeakerManager with a known speaker
  2. Feed 48kHz audio buffers from AVAudioEngine.inputNode.installTap
  3. Run speaker verification via extractSpeakerEmbedding every ~1.5s
  4. Crash occurs after 1-5 minutes of continuous operation

What we've ruled out

  • Our audio buffers are copied before dispatch (D-015 pattern)
  • SpeakerGate feeds resampled [Float] arrays, not raw AVAudioPCMBuffer
  • No concurrent access from our code — all FluidAudio calls are serialized through gateQueue and diarizeQueue
  • The unsafeForcedSync warnings originate from FluidAudio internals, not our call sites

Expected behavior

No heap corruption during sustained diarization sessions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions