Skip to content

Commit deb6ed8

Browse files
author
Jeff Brown
committed
Don't reuse StringBuilder outside of lock when dumping ANR.
The ANR dumping code was reusing the shared StringBuilder while not holding the ActivityManagerService lock. As a result, other threads could sweep in and clobber the ANR information. We don't want to hold the lock here, so just create a new StringBuilder. Change-Id: I0d91af55f5c123102cfab2cd97035491efed59c0
1 parent 27fd342 commit deb6ed8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/java/com/android/server/am/ActivityManagerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3181,7 +3181,7 @@ final void appNotResponding(ProcessRecord app, ActivityRecord activity,
31813181
}
31823182

31833183
// Log the ANR to the main log.
3184-
StringBuilder info = mStringBuilder;
3184+
StringBuilder info = new StringBuilder();
31853185
info.setLength(0);
31863186
info.append("ANR in ").append(app.processName);
31873187
if (activity != null && activity.shortComponentName != null) {

0 commit comments

Comments
 (0)