GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Crash in SDImageFramePool (lookUpImpOrForward) on background queue - v5.20.0 · Issue #3861 · SDWebImage/SDWebImage

Crash in SDImageFramePool (lookUpImpOrForward) on background queue - v5.20.0 #3861

New issue
Copy link
New issue
Copy link
Open
Open
Crash in SDImageFramePool (lookUpImpOrForward) on background queue - v5.20.0#3861
Copy link

Description

@gdossantos11
gdossantos11
opened on Dec 22, 2025
Issue body actions

I am seeing a crash in Crashlytics affecting my iOS project using SDWebImage v5.20.0 (via SPM). The crash occurs on a background thread (NSOperationQueue) related to SDImageFramePool / SDAnimatedImagePlayer.

The crash type is EXC_BAD_ACCESS / lookUpImpOrForward, indicating a message was sent to a deallocated instance (Zombie object) during an autorelease pool drain.

Environment:

SDWebImage Version: 5.20.0

Installation Method: Swift Package Manager (SPM)

iOS Version: [e.g. iOS 16, iOS 17 - fill this in if you know mainly which users are affected]

Stack Trace: The stack trace indicates a crash occurring inside an NSBlockOperation on a background queue. Notably, Frame 4 is NSINDEXSET_IS_CALLING_OUT_TO_A_BOOL_BLOCK, which implies the crash happens inside an iteration of an NSIndexSet.

Crashed: NSOperationQueue 0x1164cae00 (QOS: BACKGROUND)
0  libobjc.A.dylib                0x5d94 lookUpImpOrForward + 72
1  libobjc.A.dylib                0x40e4 _objc_msgSend_uncached + 68
2  libobjc.A.dylib                0x4e38 AutoreleasePoolPage::releaseUntil(objc_object**) + 204
3  libobjc.A.dylib                0x4b8c objc_autoreleasePoolPop + 260
4  Foundation                     0x5bc9c __NSINDEXSET_IS_CALLING_OUT_TO_A_BOOL_BLOCK__ + 24
5  Foundation                     0x4b568 -[NSBlockOperation main] + 104
...
9  Foundation                     0x80910 __NSOQSchedule_f + 172
10 libdispatch.dylib              0x13394 _dispatch_block_async_invoke2 + 148

Code Analysis & Investigation: I reviewed SDImageFramePool.m in v5.20.0. The prefetchFrameAtIndex: method creates an NSBlockOperation:

Objective-C

NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
    @strongify(self);
    if (!self) { return; }
    UIImage *frame = [animatedProvider animatedImageFrameAtIndex:index];
    [self setFrame:frame atIndex:index];
}];

However, SDImageFramePool.m uses NSMutableDictionary for its buffer, not NSIndexSet. The presence of NSINDEXSET_IS_CALLING_OUT_TO_A_BOOL_BLOCK in the stack trace strongly suggests that the crash is actually occurring inside the provider ([animatedProvider animatedImageFrameAtIndex:index]) or within SDAnimatedImage internals which likely uses NSIndexSet to manage frame cache/unloading.

It appears to be a race condition where the animatedProvider or an object inside its internal array is deallocated while the background prefetch operation is still running.

Possible Fix: Is it possible that animatedProvider is not being captured strongly enough during the asynchronous operation execution, or that SDAnimatedImage's internal frame cache is not thread-safe during high-load prefetching?

Reacted by coderabbitai

Activity

  1. coderabbitai commented on Dec 22, 2025

    @coderabbitai
    coderabbitaiBot
    on Dec 22, 2025 – with coderabbitai
    More actions

    📝 CodeRabbit Plan Mode

    Generate an implementation plan and prompts that you can use with your favorite coding agent.

    • Create Plan
    Examples
    • Example 1
    • Example 2

    🔗 Similar Issues

    Possible Duplicates

    • Updated to version 5.21.0, SDImageIOAnimatedCoder crash #3812

    Related Issues

    • +[SDImageIOAnimatedCoder createFrameAtIndex:source:scale:preserveAspectRatio:thumbnailSize:lazyDecode:animatedImage:] #3768
    • EXC_BAD_ACCESS Exception 1, Code 1, KERN_INVALID_ADDRESS #3840
    • Crash in SDWebImageDownloaderOperation start (objc_retain) on iOS 26 only #3842
    • SDWebImage iOS Demo shows HDR images as completely black on iOS Simulator #3857
    • swift_dynamicCastFailure SDAnimatedImageView #3794
    • operation.cacheOperation Crash Only in iOS 26. #3849
    🔗 Related PRs

    #3813 - Reduce memory peak when playing the GIF on SDAnimatedImageView [merged]
    #3826 - Avoid self if be nil in block. [merged]
    #3855 - Using @synchronized to always lock the cache/loader operation to ensure thread-safe. Fix issue on iOS 26 [merged]
    #3856 - Try to move the SDWebImageDownloaderOperation dataTask property initialization into synchronized lock to avoid thread-safe issue [merged]

    👤 Suggested Assignees
    • jiangleisir
    • dreampiggy
    • fengCaifan
    • simonmcl
    • mathewlee83

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord or schedule a call!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.