Merge "Fix infinite recursion due to error log message"
am: a57d7229ae
Change-Id: I5ffc80d4d7080b2cc2aa30de00a1d99dfbbad8f4
This commit is contained in:
@@ -237,7 +237,10 @@ public class Session {
|
||||
// keep track of calls and bail if we hit the recursion limit
|
||||
private String getFullSessionId(int parentCount) {
|
||||
if (parentCount >= SESSION_RECURSION_LIMIT) {
|
||||
Log.w(LOG_TAG, "getFullSessionId: Hit recursion limit!");
|
||||
// Don't use Telecom's Log.w here or it will cause infinite recursion because it will
|
||||
// try to add session information to this logging statement, which will cause it to hit
|
||||
// this condition again and so on...
|
||||
android.util.Slog.w(LOG_TAG, "getFullSessionId: Hit recursion limit!");
|
||||
return TRUNCATE_STRING + mSessionId;
|
||||
}
|
||||
// Cache mParentSession locally to prevent a concurrency problem where
|
||||
@@ -265,7 +268,11 @@ public class Session {
|
||||
Session topNode = this;
|
||||
while (topNode.getParentSession() != null) {
|
||||
if (currParentCount >= SESSION_RECURSION_LIMIT) {
|
||||
Log.w(LOG_TAG, "getRootSession: Hit recursion limit from " + callingMethod);
|
||||
// Don't use Telecom's Log.w here or it will cause infinite recursion because it
|
||||
// will try to add session information to this logging statement, which will cause
|
||||
// it to hit this condition again and so on...
|
||||
android.util.Slog.w(LOG_TAG, "getRootSession: Hit recursion limit from "
|
||||
+ callingMethod);
|
||||
break;
|
||||
}
|
||||
topNode = topNode.getParentSession();
|
||||
@@ -289,7 +296,10 @@ public class Session {
|
||||
private void printSessionTree(int tabI, StringBuilder sb, int currChildCount) {
|
||||
// Prevent infinite recursion.
|
||||
if (currChildCount >= SESSION_RECURSION_LIMIT) {
|
||||
Log.w(LOG_TAG, "printSessionTree: Hit recursion limit!");
|
||||
// Don't use Telecom's Log.w here or it will cause infinite recursion because it will
|
||||
// try to add session information to this logging statement, which will cause it to hit
|
||||
// this condition again and so on...
|
||||
android.util.Slog.w(LOG_TAG, "printSessionTree: Hit recursion limit!");
|
||||
sb.append(TRUNCATE_STRING);
|
||||
return;
|
||||
}
|
||||
@@ -315,7 +325,10 @@ public class Session {
|
||||
private synchronized void getFullMethodPath(StringBuilder sb, boolean truncatePath,
|
||||
int parentCount) {
|
||||
if (parentCount >= SESSION_RECURSION_LIMIT) {
|
||||
Log.w(LOG_TAG, "getFullMethodPath: Hit recursion limit!");
|
||||
// Don't use Telecom's Log.w here or it will cause infinite recursion because it will
|
||||
// try to add session information to this logging statement, which will cause it to hit
|
||||
// this condition again and so on...
|
||||
android.util.Slog.w(LOG_TAG, "getFullMethodPath: Hit recursion limit!");
|
||||
sb.append(TRUNCATE_STRING);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,18 @@ public class SessionManager {
|
||||
return createSubsession(false);
|
||||
}
|
||||
|
||||
private synchronized Session createSubsession(boolean isStartedFromActiveSession) {
|
||||
/**
|
||||
* Creates a new subsession based on an existing session. Will not be started until
|
||||
* {@link #continueSession(Session, String)} or {@link #cancelSubsession(Session)} is called.
|
||||
* <p>
|
||||
* Only public for testing!
|
||||
* @param isStartedFromActiveSession true if this subsession is being created for a task on the
|
||||
* same thread, false if it is being created for a related task on another thread.
|
||||
* @return a new {@link Session}, call {@link #continueSession(Session, String)} to continue the
|
||||
* session and {@link #endSession()} when done with this subsession.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public synchronized Session createSubsession(boolean isStartedFromActiveSession) {
|
||||
int threadId = getCallingThreadId();
|
||||
Session threadSession = mSessionMapper.get(threadId);
|
||||
if (threadSession == null) {
|
||||
|
||||
Reference in New Issue
Block a user