Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Multi-thread: Infinite loop in trimToSize #81

@la-urre

Description

@la-urre

Hello guys,

I use DiskLruCache in a multi-thread environment. I get an infinite loop in the trimToSize method:

while (size > maxSize) {
Map.Entry<String, Entry> toEvict = lruEntries.entrySet().iterator().next();
remove(toEvict.getKey());
}

The remove call fails to remove the entry, as an other thread is editing the toEvict entry. Shouldn't we check if the remove worked, and for example silently return if it did not ?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions