You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "vinodkc (via GitHub)" <gi...@apache.org> on 2025/12/02 04:43:03 UTC
[PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
vinodkc opened a new pull request, #53275:
URL: https://github.com/apache/spark/pull/53275
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'common/utils/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
Currently, the Spark Connect test server's stdout and stderr are discarded when SPARK_DEBUG_SC_JVM_CLIENT=false, making it difficult to debug test failures. This PR changes the behavior to redirect the server output to timestamped log files in the target/ directory for later inspection.
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
SparkConnectJdbcDataTypeSuite randomly hangs because the child server process blocks on write() calls when stdout/stderr pipe buffers fill up. Without consuming the output, the buffers reach capacity and cause the process to block indefinitely.
Instead of `Redirect.DISCARD` , redirect the logs into log files
Redirect server output to log files in `sql/connect/client/jvm/target/`
Use timestamped filenames to preserve logs from multiple test runs
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as new features, bug fixes, or other behavior changes. Documentation-only updates are not considered user-facing changes.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
No
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
Confirmed log files are created with following name pattern in `sql/connect/client/jvm/target/`:
```
spark-connect-test-server-stdout-<timestamp>.log
spark-connect-test-server-stderr-<timestamp>.log
```
### Was this patch authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this patch, please include the
phrase: 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
No.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579678925
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
Review Comment:
When debug `ON`, it is already redirected to ./target/unit-tests.log .
Only when debug `OFF`. we don't get log4j conf , in that case we preserve the logs in `./sql/connect/client/jvm/target/spark-connect-test-server-*.log`
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #53275:
URL: https://github.com/apache/spark/pull/53275#issuecomment-3607756424
Thank you, @vinodkc and all.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579629130
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
+ // Redirect stdout and stderr to log files.
+ // If output is not consumed, the stdout/stderr pipe buffers will fill up,
+ // causing the server process to block on write() calls.
+ val targetDir = new File(s"$connectClientHomeDir/target")
+ targetDir.mkdirs()
+ val timestamp = System.currentTimeMillis()
+ val stdoutLogFile = new File(targetDir, s"spark-connect-test-server-stdout-$timestamp.log")
+ val stderrLogFile = new File(targetDir, s"spark-connect-test-server-stderr-$timestamp.log")
Review Comment:
>are them in the same directory as the log4j files?
No, not in the same directory as the log4j files.
Reason: When SPARK_DEBUG_SC_JVM_CLIENT=false, log4j configuration is not passed to the server
When
`SPARK_DEBUG_SC_JVM_CLIENT=true build/sbt "connect-client-jdbc/testOnly org.apache.spark.sql.connect.client.jdbc.SparkConnectJdbcDataTypeSuite"`
>what's the name of log4j file:
./target/unit-tests.log
When
`SPARK_DEBUG_SC_JVM_CLIENT=false build/sbt "connect-client-jdbc/testOnly org.apache.spark.sql.connect.client.jdbc.SparkConnectJdbcDataTypeSuite"`
>what's the name of log4j file:
No log4j file is generated. log4j configuration is not passed to the server
So, we redirect the stdout/stderr to
```
./sql/connect/client/jvm/target/spark-connect-test-server-stderr-<timestamp>.log
./sql/connect/client/jvm/target/spark-connect-test-server-stdout-<timestamp>.log
```
Please refer this comment : https://github.com/apache/spark/pull/53261#discussion_r2579619880
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #53275:
URL: https://github.com/apache/spark/pull/53275#issuecomment-3607439299
thanks, merging to master/4.1!
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579674420
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
Review Comment:
Fixed with `builder.redirectError(..)`
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579688968
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
Review Comment:
I understand the current behavior - it only persists logs when debug is on. But since this PR proposes to change it to persist logs always, why not just always follow the existing debug-on behavior?
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2583014914
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -77,7 +86,7 @@ object SparkConnectServerUtils {
command += "--jars" += catalystTestJar
command += "--conf" += s"spark.connect.grpc.binding.port=$port"
command ++= testConfigs
- command ++= debugConfigs
Review Comment:
Done
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579576019
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
Review Comment:
These APIs do not work with file streams? chatgpt says it can work
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579629130
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
+ // Redirect stdout and stderr to log files.
+ // If output is not consumed, the stdout/stderr pipe buffers will fill up,
+ // causing the server process to block on write() calls.
+ val targetDir = new File(s"$connectClientHomeDir/target")
+ targetDir.mkdirs()
+ val timestamp = System.currentTimeMillis()
+ val stdoutLogFile = new File(targetDir, s"spark-connect-test-server-stdout-$timestamp.log")
+ val stderrLogFile = new File(targetDir, s"spark-connect-test-server-stderr-$timestamp.log")
Review Comment:
>are them in the same directory as the log4j files?
No, not in the same directory as the log4j files.
Reason: When SPARK_DEBUG_SC_JVM_CLIENT=false, log4j configuration is not passed to the server
When
`SPARK_DEBUG_SC_JVM_CLIENT=true build/sbt "connect-client-jdbc/testOnly org.apache.spark.sql.connect.client.jdbc.SparkConnectJdbcDataTypeSuite"`
>what's the name of log4j file:
./target/unit-tests.log
When
`SPARK_DEBUG_SC_JVM_CLIENT=false build/sbt "connect-client-jdbc/testOnly org.apache.spark.sql.connect.client.jdbc.SparkConnectJdbcDataTypeSuite"`
>what's the name of log4j file:
No log4j file is generated. log4j configuration is not passed to the server
So, we redirect the stdout/stderr to
```
./sql/connect/client/jvm/target/spark-connect-test-server-stderr-<timestamp>.log
./sql/connect/client/jvm/target/spark-connect-test-server-stdout-<timestamp>.log
```
Please refer this comment : https://github.com/apache/spark/pull/53261#discussion_r2579619880
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2580227576
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
Review Comment:
> Do you suggest redirecting to ./sql/connect/client/jvm/target/spark-connect-test-server-*.log on debug ON as well?
@vinodkc, haven't seen this message when replying.
either `unit-tests.log`(I lean toward this one) or `spark-connect-test-server-*.log` is fine to me, I just think we should have a unified behavior to avoid unnecessary complexity. BTW, for proposed new log filename, you may need to check the GHA workflow to ensure it is caught by upload logs
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2582628835
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
+ // Redirect stdout and stderr to log files.
+ // If output is not consumed, the stdout/stderr pipe buffers will fill up,
+ // causing the server process to block on write() calls.
+ val targetDir = new File(s"$connectClientHomeDir/target")
+ targetDir.mkdirs()
+ val timestamp = System.currentTimeMillis()
+ val stdoutLogFile = new File(targetDir, s"spark-connect-test-server-stdout-$timestamp.log")
+ val stderrLogFile = new File(targetDir, s"spark-connect-test-server-stderr-$timestamp.log")
Review Comment:
@cloud-fan , I changed the implementation. Now it will use the log4j conf to write the logs on both debug and non-debug modes.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #53275: [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files
URL: https://github.com/apache/spark/pull/53275
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579701267
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
+ // Redirect stdout and stderr to log files.
+ // If output is not consumed, the stdout/stderr pipe buffers will fill up,
+ // causing the server process to block on write() calls.
+ val targetDir = new File(s"$connectClientHomeDir/target")
+ targetDir.mkdirs()
+ val timestamp = System.currentTimeMillis()
+ val stdoutLogFile = new File(targetDir, s"spark-connect-test-server-stdout-$timestamp.log")
+ val stderrLogFile = new File(targetDir, s"spark-connect-test-server-stderr-$timestamp.log")
Review Comment:
thanks for the detailed explanation, let's continue the discussion at https://github.com/apache/spark/pull/53275#discussion_r2579584308
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579678925
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
Review Comment:
When debug `ON`, it is already redirected to ./target/unit-tests.log. Only when debug `OFF` do we not get the log4j conf; in that case, we preserve the logs in `./sql/connect/client/jvm/target/spark-connect-test-server-*.log`.
Do you suggest redirecting to ./sql/connect/client/jvm/target/spark-connect-test-server-*.log on debug `ON` as well?
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579584308
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
Review Comment:
is it necessary to have different behaviors for debug on and off if we choose to preserve the logs always?
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2582637988
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
Review Comment:
@pan3793, yes, I added the code to refer to the log4j config for persisting logs in both test modes.
Log file name is `unit-tests.log`
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579568298
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
+ // Redirect stdout and stderr to log files.
+ // If output is not consumed, the stdout/stderr pipe buffers will fill up,
+ // causing the server process to block on write() calls.
+ val targetDir = new File(s"$connectClientHomeDir/target")
+ targetDir.mkdirs()
+ val timestamp = System.currentTimeMillis()
+ val stdoutLogFile = new File(targetDir, s"spark-connect-test-server-stdout-$timestamp.log")
+ val stderrLogFile = new File(targetDir, s"spark-connect-test-server-stderr-$timestamp.log")
Review Comment:
are them in the same directory as the log4j files? what's the name of log4j files?
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579701267
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
+ // Redirect stdout and stderr to log files.
+ // If output is not consumed, the stdout/stderr pipe buffers will fill up,
+ // causing the server process to block on write() calls.
+ val targetDir = new File(s"$connectClientHomeDir/target")
+ targetDir.mkdirs()
+ val timestamp = System.currentTimeMillis()
+ val stdoutLogFile = new File(targetDir, s"spark-connect-test-server-stdout-$timestamp.log")
+ val stderrLogFile = new File(targetDir, s"spark-connect-test-server-stderr-$timestamp.log")
Review Comment:
thanks for the detailed explanation, let's continue the discussion at https://github.com/apache/spark/pull/53275#discussion_r2579584308
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2580227576
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
Review Comment:
> Do you suggest redirecting to ./sql/connect/client/jvm/target/spark-connect-test-server-*.log on debug ON as well?
@vinodkc, haven't seen this message when replying.
either `unit-tests.log` or `spark-connect-test-server-*.log` is fine to me, I just think we should have a unified behavior to avoid unnecessary complexity. BTW, for purposed new log filename, you may need to check the GHA workflow to ensure it is caught by upload logs
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2579629130
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
+ // Redirect stdout and stderr to log files.
+ // If output is not consumed, the stdout/stderr pipe buffers will fill up,
+ // causing the server process to block on write() calls.
+ val targetDir = new File(s"$connectClientHomeDir/target")
+ targetDir.mkdirs()
+ val timestamp = System.currentTimeMillis()
+ val stdoutLogFile = new File(targetDir, s"spark-connect-test-server-stdout-$timestamp.log")
+ val stderrLogFile = new File(targetDir, s"spark-connect-test-server-stderr-$timestamp.log")
Review Comment:
>are them in the same directory as the log4j files?
No, not in the same directory as the log4j files.
Reason: When SPARK_DEBUG_SC_JVM_CLIENT=false, log4j configuration is not passed to the server
>what's the name of log4j files?
sparkparentdir > target\unit-tests.log
Please refer this comment : https://github.com/apache/spark/pull/53261#discussion_r2579619880
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2582883073
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -77,7 +86,7 @@ object SparkConnectServerUtils {
command += "--jars" += catalystTestJar
command += "--conf" += s"spark.connect.grpc.binding.port=$port"
command ++= testConfigs
- command ++= debugConfigs
Review Comment:
>where do we define debugConfigs?
`debugConfigs` is defined in [IntegrationTestUtils](https://github.com/apache/spark/blob/master/sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/IntegrationTestUtils.scala#L62) ,
>can we remove it now?
`debugConfigs` may be required for other other/future Testsuites, so I didn't remove it.
`log4jConfigs` is same as `debugConfigs` , except `if (isDebug)` condition.
To support both debug and non debug test modes , if (isDebug) is not required .
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -77,7 +86,7 @@ object SparkConnectServerUtils {
command += "--jars" += catalystTestJar
command += "--conf" += s"spark.connect.grpc.binding.port=$port"
command ++= testConfigs
- command ++= debugConfigs
Review Comment:
>where do we define debugConfigs?
`debugConfigs` is defined in [IntegrationTestUtils](https://github.com/apache/spark/blob/master/sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/IntegrationTestUtils.scala#L62) ,
>can we remove it now?
`debugConfigs` may be required for other/future Testsuites, so I didn't remove it.
`log4jConfigs` is same as `debugConfigs` , except `if (isDebug)` condition.
To support both debug and non debug test modes , if (isDebug) is not required .
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2582628835
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
+ // Redirect stdout and stderr to log files.
+ // If output is not consumed, the stdout/stderr pipe buffers will fill up,
+ // causing the server process to block on write() calls.
+ val targetDir = new File(s"$connectClientHomeDir/target")
+ targetDir.mkdirs()
+ val timestamp = System.currentTimeMillis()
+ val stdoutLogFile = new File(targetDir, s"spark-connect-test-server-stdout-$timestamp.log")
+ val stderrLogFile = new File(targetDir, s"spark-connect-test-server-stderr-$timestamp.log")
Review Comment:
@cloud-fan , I changed the implementation. Now it will use the log4j conf to write the logs on both debug and non-debug modes.
> are them in the same directory as the log4j files?
Yes, same directory and same filename
> what's the name of log4j files?
./target/unit-tests.log
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
+ // Redirect stdout and stderr to log files.
+ // If output is not consumed, the stdout/stderr pipe buffers will fill up,
+ // causing the server process to block on write() calls.
+ val targetDir = new File(s"$connectClientHomeDir/target")
+ targetDir.mkdirs()
+ val timestamp = System.currentTimeMillis()
+ val stdoutLogFile = new File(targetDir, s"spark-connect-test-server-stdout-$timestamp.log")
+ val stderrLogFile = new File(targetDir, s"spark-connect-test-server-stderr-$timestamp.log")
Review Comment:
@cloud-fan , I changed the implementation. Now it will use the log4j conf to write the logs on both debug and non-debug modes.
> are them in the same directory as the log4j files?
Yes, same directory and same filename
> what's the name of log4j files?
./target/unit-tests.log
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "vinodkc (via GitHub)" <gi...@apache.org>.
vinodkc commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2582637988
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -93,21 +94,47 @@ object SparkConnectServerUtils {
if (isDebug) {
builder.redirectError(Redirect.INHERIT)
builder.redirectOutput(Redirect.INHERIT)
- } else {
- // If output is not consumed, the stdout/stderr pipe buffers will fill up,
- // causing the server process to block on write() calls
- builder.redirectError(Redirect.DISCARD)
- builder.redirectOutput(Redirect.DISCARD)
}
val process = builder.start()
consoleOut = process.getOutputStream
+ if (!isDebug) {
Review Comment:
@pan3793, yes, I added the code to refer to the log4j config for persisting logs in both test modes.
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-54551][CONNECT][TESTS][FOLLOWUP] Redirect Test Spark connect server output stream to files [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #53275:
URL: https://github.com/apache/spark/pull/53275#discussion_r2582823788
##########
sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/test/RemoteSparkSession.scala:
##########
@@ -77,7 +86,7 @@ object SparkConnectServerUtils {
command += "--jars" += catalystTestJar
command += "--conf" += s"spark.connect.grpc.binding.port=$port"
command ++= testConfigs
- command ++= debugConfigs
Review Comment:
where do we define `debugConfigs`? can we remove it now?
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org