Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2cc8ce4c authored by Hans Boehm's avatar Hans Boehm
Browse files

Better log why zygote falls back to Java

Zygote sometimes unexpectedly exits the native fork loop.

Bug: 430140389
Bug: 406853000
Flag: EXEMPT log only update
Test: Build and boot, look at boot log
Change-Id: I3f4d9c7664927aa05499aa0735d30a72321a7094
parent 85621a03
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -244,6 +244,8 @@ class ZygoteConnection {

                if (parsedArgs.mInvokeWith != null || parsedArgs.mStartChildZygote
                        || !multipleOK || peer.getUid() != Process.SYSTEM_UID) {
                    Log.w(TAG, "Resorting to Java fork code; multipleOK = " + multipleOK
                            + (parsedArgs.mInvokeWith != null ? "; invokeWith used" : ""));
                    // Continue using old code for now. TODO: Handle these cases in the other path.
                    pid = Zygote.forkAndSpecialize(parsedArgs.mUid, parsedArgs.mGid,
                            parsedArgs.mGids, parsedArgs.mRuntimeFlags, rlimits,
+16 −0
Original line number Diff line number Diff line
@@ -253,6 +253,22 @@ class NativeCommandBuffer {
          niceNameAddr(),
          static_cast<unsigned>(mEnd), static_cast<unsigned>(mNext),
          static_cast<int>(mLinesLeft), mFd);
    if (niceNameAddr()[0] == '\0') {
      // The above didn't identify the command; dump buffer prefix as well.
      static constexpr uint32_t DUMP_SIZE = 40;
      char bufferCopy[DUMP_SIZE + 1];
      uint32_t i = 0;
      for (; i < DUMP_SIZE && i < mEnd; ++i) {
        if (mBuffer[i] < 0x20 || mBuffer[i] >= 0x7f) {
          // Not easily printable. Includes the expected newlines.
          bufferCopy[i] = '?';
        } else {
          bufferCopy[i] = mBuffer[i];
        }
      }
      bufferCopy[i] = '\0';
      ALOGD("Buffer content prefix: %s", bufferCopy);
    }
  }

 private: