Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileInputStream resource leak #166

Open
DawidStankiewicz opened this issue Jul 9, 2024 · 0 comments
Open

FileInputStream resource leak #166

DawidStankiewicz opened this issue Jul 9, 2024 · 0 comments

Comments

@DawidStankiewicz
Copy link

There is a resource leak at VideoThumbnailPlugin.java:264

D/StrictMode(27758): StrictMode policy violation: android.os.strictmode.LeakedClosableViolation: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
D/StrictMode(27758): 	at android.os.StrictMode$AndroidCloseGuardReporter.report(StrictMode.java:1877)
D/StrictMode(27758): 	at dalvik.system.CloseGuard.warnIfOpen(CloseGuard.java:286)
D/StrictMode(27758): 	at java.io.FileInputStream.finalize(FileInputStream.java:493)
D/StrictMode(27758): 	at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:289)
D/StrictMode(27758): 	at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:276)
D/StrictMode(27758): 	at java.lang.Daemons$Daemon.run(Daemons.java:137)
D/StrictMode(27758): 	at java.lang.Thread.run(Thread.java:919)
D/StrictMode(27758): Caused by: java.lang.Throwable: Explicit termination method 'close' not called
D/StrictMode(27758): 	at dalvik.system.CloseGuard.open(CloseGuard.java:237)
D/StrictMode(27758): 	at java.io.FileInputStream.<init>(FileInputStream.java:174)
D/StrictMode(27758): 	at java.io.FileInputStream.<init>(FileInputStream.java:115)
D/StrictMode(27758): 	at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.setDataSource(VideoThumbnailPlugin.java:264)
D/StrictMode(27758): 	at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.createVideoThumbnail(VideoThumbnailPlugin.java:215)
D/StrictMode(27758): 	at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.buildThumbnailData(VideoThumbnailPlugin.java:123)
D/StrictMode(27758): 	at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.access$100(VideoThumbnailPlugin.java:32)
D/StrictMode(27758): 	at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin$1.run(VideoThumbnailPlugin.java:83)
D/StrictMode(27758): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
D/StrictMode(27758): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
D/StrictMode(27758): 	... 1 more

To reproduce, enable strict mode by putting this code in MainActivity and generate a thumbnail.

        if (BuildConfig.DEBUG) {
            StrictMode.setVmPolicy(new VmPolicy.Builder()
                    .detectLeakedClosableObjects()
                    .penaltyLog()
                    .build());
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant