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

ContentDataSource fails to retain AssetFileDescriptor - file randomly closed by GC #1759

Closed
cbfiddle opened this issue Aug 22, 2016 · 4 comments
Assignees
Labels

Comments

@cbfiddle
Copy link
Contributor

ContentDataSource calls openAssetFileDescriptor but fails to retain the returned AssetFileDescriptor. The doc for this method says that the caller is responsible for closing the asset file descriptor. The effect is that the AssetFileDescriptor is GCed at some random time at which point the underlying file descriptor is invalidated, causing an IOException if it is still in use at that time.

@ojw28 ojw28 added the bug label Aug 22, 2016
@ojw28
Copy link
Contributor

ojw28 commented Aug 22, 2016

Thanks for reporting this!

@asadw1
Copy link

asadw1 commented Aug 23, 2016

at some random time

Is there any way you can see a stacktrace of the execution? This can help find where the GC is happening.

@ojw28
Copy link
Contributor

ojw28 commented Aug 23, 2016

I'm not sure it's relevant when the GC happens. The point is that the DataSource implementations shouldn't be affected by it. We have a fix internally, and will push to GitHub soon.

@ojw28 ojw28 self-assigned this Aug 23, 2016
@asadw1
Copy link

asadw1 commented Aug 23, 2016

Noted. Thanks!

ojw28 added a commit that referenced this issue Aug 31, 2016
Also tweak how the null checks happen in a few DataSource
implementations (should be no-op changes, but allow you
to look at close() and be happy it does the right thing
without having to loop at the open() implementations).

Issue: #1759

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131172427
ojw28 added a commit that referenced this issue Aug 31, 2016
Also tweak how the null checks happen in a few DataSource
implementations (should be no-op changes, but allow you
to look at close() and be happy it does the right thing
without having to loop at the open() implementations).

Issue: #1759

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131172427
@ojw28 ojw28 closed this as completed Aug 31, 2016
@google google locked and limited conversation to collaborators Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants