yaooqinn commented on code in PR #49943:
URL: https://github.com/apache/spark/pull/49943#discussion_r1955477351


##########
core/src/main/scala/org/apache/spark/util/Utils.scala:
##########
@@ -2439,11 +2439,17 @@ private[spark] object Utils
 
   /**
    * Returns the current user name. This is the currently logged in user, 
unless that's been
-   * overridden by the `SPARK_USER` environment variable.
+   * overridden by the `SPARK_USER` environment variable. In case of 
exceptions, returns 'spark'.
    */
   def getCurrentUserName(): String = {
-    Option(System.getenv("SPARK_USER"))
-      .getOrElse(UserGroupInformation.getCurrentUser().getShortUserName())
+    try {
+      Option(System.getenv("SPARK_USER"))
+        .getOrElse(UserGroupInformation.getCurrentUser().getShortUserName())
+    } catch {
+      // JEP 486: Permanently Disable the Security Manager
+      case e: UnsupportedOperationException if 
e.getMessage().contains("getSubject") =>
+        "spark"

Review Comment:
   is it safer to fallback to the JVM property `user.name`?



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to