Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
921b1748
Commit
921b1748
authored
9 months ago
by
Mitch Phillips
Committed by
Gerrit Code Review
9 months ago
Browse files
Options
Downloads
Plain Diff
Merge "Workaround bad GC of tombstone watcher." into main
parents
a7d78963
476ed072
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
services/core/java/com/android/server/os/NativeTombstoneManager.java
+12
-0
12 additions, 0 deletions
...re/java/com/android/server/os/NativeTombstoneManager.java
with
12 additions
and
0 deletions
services/core/java/com/android/server/os/NativeTombstoneManager.java
+
12
−
0
View file @
921b1748
...
...
@@ -56,6 +56,7 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.lang.ref.Reference
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Optional
;
...
...
@@ -73,6 +74,9 @@ public final class NativeTombstoneManager {
private
final
Context
mContext
;
private
final
Handler
mHandler
;
// TODO(b/339371242): The garbage collector is misbehaving, and we must have
// a reference to this member outside the constructor. More details in the
// corresponding comment elsewhere in this class.
private
final
TombstoneWatcher
mWatcher
;
private
final
ReentrantLock
mTmpFileLock
=
new
ReentrantLock
();
...
...
@@ -139,6 +143,14 @@ public final class NativeTombstoneManager {
processName
=
parsedTombstone
.
get
().
getProcessName
();
}
BootReceiver
.
addTombstoneToDropBox
(
mContext
,
path
,
isProtoFile
,
processName
,
mTmpFileLock
);
// TODO(b/339371242): An optimizer on WearOS is misbehaving and this member is being garbage
// collected as it's never referenced inside this class outside of the constructor. But,
// it's a file watcher, and needs to stay alive to do its job. So, add a cheap check here to
// force the GC to behave itself. From a technical perspective, it's possible that we need
// to add this trick to every single member function, but this seems to work correctly in
// practice and avoids polluting a lot more of this class.
Reference
.
reachabilityFence
(
mWatcher
);
}
private
Optional
<
TombstoneFile
>
handleProtoTombstone
(
File
path
,
boolean
addToList
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment