-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-29720][CORE] Add linux condition to make ProcfsMetricsGetter more complete #26365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,8 @@ import scala.collection.mutable | |
| import scala.collection.mutable.ArrayBuffer | ||
| import scala.util.Try | ||
|
|
||
| import org.apache.hadoop.util.Shell | ||
|
|
||
| import org.apache.spark.{SparkEnv, SparkException} | ||
| import org.apache.spark.internal.{config, Logging} | ||
| import org.apache.spark.util.Utils | ||
|
|
@@ -62,13 +64,14 @@ private[spark] class ProcfsMetricsGetter(procfsDir: String = "/proc/") extends L | |
| SparkEnv.get.conf.get(config.EVENT_LOG_STAGE_EXECUTOR_METRICS) | ||
| val shouldLogStageExecutorProcessTreeMetrics = | ||
| SparkEnv.get.conf.get(config.EVENT_LOG_PROCESS_TREE_METRICS) | ||
| procDirExists.get && shouldLogStageExecutorProcessTreeMetrics && shouldLogStageExecutorMetrics | ||
| procDirExists.get && shouldLogStageExecutorProcessTreeMetrics && | ||
| shouldLogStageExecutorMetrics && Shell.LINUX | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's move the os check in the first condition.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure to support only Linux? Other Unix-like systems which have /proc?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In hadoop ProcfsMetrics, it checks this ProcfsBasedProcessTree and it already exists long time.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like in isProcfsAvailable, we check /proc existence instead of checking Linux like hadoop. Isn't it enough? And for other Unit-like systems which have /proc? We do not need to follow ProcfsBasedProcessTree.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIC the procfs is the linux feature, other unix-like os may be try to compatible with it. Check the /proc dir is not a better idea than check linux os. One point is that, someone can change the /proc information which os not support procfs native and it will be a vulnerability.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If /proc is in other Unix-like systems, this change actually removes the support on these systems. Unless we are sure current code does not work for such systems, I think we should not simply remove their support. |
||
| } | ||
| } | ||
|
|
||
| private def computePid(): Int = { | ||
| if (!isAvailable || testing) { | ||
| return -1; | ||
| return -1 | ||
| } | ||
| try { | ||
| // This can be simplified in java9: | ||
|
|
@@ -88,7 +91,7 @@ private[spark] class ProcfsMetricsGetter(procfsDir: String = "/proc/") extends L | |
|
|
||
| private def computePageSize(): Long = { | ||
| if (testing) { | ||
| return 4096; | ||
| return 4096 | ||
| } | ||
| try { | ||
| val cmd = Array("getconf", "PAGESIZE") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about checking
os.nameinstead of using hadoop-commons?