roryqi opened a new issue, #12975:
URL: https://github.com/apache/gravitino/issues/12975

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   `PrincipalUtils.doAs` catches `Error`, logs it, and replaces it with a
   `RuntimeException`. Fatal JVM conditions such as `OutOfMemoryError` are
   therefore exposed as ordinary operation failures, preventing callers and
   error handlers from recognizing the actual failure type.
   
   The original `Error` should be logged with its stack trace and rethrown
   unchanged.
   
   ### Error message and/or stacktrace
   
   The top-level failure is currently reported as:
   
   ```
   java.lang.RuntimeException: doAs method encountered an unexpected exception
       at org.apache.gravitino.utils.PrincipalUtils.doAs(PrincipalUtils.java:60)
   ```
   
   For example, an `OutOfMemoryError: Metaspace` raised by the privileged action
   is converted into this `RuntimeException`.
   
   ### How to reproduce
   
   1. Call `PrincipalUtils.doAs` with a privileged action that throws an
      `AssertionError` or another `Error`.
   2. Observe that `doAs` throws a new `RuntimeException` instead of the 
original
      `Error`.
   
   ### Additional context
   
   This was observed on 1.3.0-rc2 with an `OutOfMemoryError: Metaspace`, and the
   same behavior remains on the main branch.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to