Kingfisher: Pointer double free issue with ImagePrefetcher

Created on 6 Feb 2019  Â·  5Comments  Â·  Source: onevcat/Kingfisher

Check List

Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.

Issue Description

What

Crashed when prefetching images in a row.

Reproduce

You can test it on the latest Kingfisher codebase in ImagePrefetcherTests.swift.

func testPrefetchMultiTimes() {
        testURLs.forEach { stub($0, data: testImageData) }

        for _ in 0..<10000 {
            let prefetcher = ImagePrefetcher(resources: testURLs)
            prefetcher.start()
        }
    }

You may need to run it serveral times before the crashed happened.

Other comment

screen shot 2019-02-06 at 2 15 20 pm

Most helpful comment

5.1.1 was released.

All 5 comments

Each prefetcher instance runs on an independent serial queue, while they are using the same image downloader. When downloading images, the downloader concurrently overwrites the same task's onTaskDone delegate's block, which cause a double free issue.

Thanks for reporting this. I will check it as soon as I can.

Should be fixed by making all prefetcher use the same queue.

Will the new version release in coming days?

5.1.1 was released.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rainerjungwirth picture rainerjungwirth  Â·  4Comments

iLucas97 picture iLucas97  Â·  5Comments

nickgate picture nickgate  Â·  4Comments

HuseyinVural picture HuseyinVural  Â·  4Comments

Minitour picture Minitour  Â·  4Comments