glide icon indicating copy to clipboard operation
glide copied to clipboard

Proof of concept for investigation of "Cannot recycle a resource while it is still acquired"

Open TWiStErRob opened this issue 2 years ago • 4 comments

Description

Trace asynchronous calls across Handler messages. It's probably not acceptable in its current form due to many allocations. I wonder how this could make it to production. Is there a way to "debug" Glide? Feature flag?

Motivation and Context

https://github.com/bumptech/glide/issues/4507 and https://github.com/bumptech/glide/issues/5211 have no idea why it's happening, this would highlight which part of the app is causing the issue.

TWiStErRob avatar Oct 12 '23 15:10 TWiStErRob

It could be done with a default off log tag that's checked once statically? You could avoid capturing the stack trace unless it's enabled.

sjudd avatar Oct 17 '23 04:10 sjudd

I think a Log tag is not enough, they need to deploy it to production so that they can get crash traces from real devices. And they can't execute adb shell setprop there. It's not reproducible in dev envs as I understood. Glide users need to control this explicitly to opt in.

TWiStErRob avatar Oct 17 '23 07:10 TWiStErRob

Although a simple static boolean variable would work, I guess.

TWiStErRob avatar Oct 17 '23 07:10 TWiStErRob

Hmm for production use cases we could use the flags system, might be annoying to pipe it through, but once done you can read from some set of flag values during initialization to control this: https://github.com/bumptech/glide/blob/75599b7af05eeca1393c8f4267adb78e88e7821e/library/src/main/java/com/bumptech/glide/GlideBuilder.java#L452

sjudd avatar Nov 03 '23 02:11 sjudd