Skip to content

Conversation

@vinodkc
Copy link
Contributor

@vinodkc vinodkc commented Dec 2, 2025

What changes were proposed in this pull request?

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 enables log4j logging for Test Spark Connect server in all test modes (both debug and non-debug) by always configuring log4j2.properties.

Why are the changes needed?

When SPARK_DEBUG_SC_JVM_CLIENT=false
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 log4j files

Does this PR introduce any user-facing change?

No

How was this patch tested?

Tested and confirmed that log files are created when

  1. SPARK_DEBUG_SC_JVM_CLIENT=false build/sbt "connect-client-jdbc/testOnly org.apache.spark.sql.connect.client.jdbc.SparkConnectJdbcDataTypeSuite"

OR

  1. SPARK_DEBUG_SC_JVM_CLIENT=true build/sbt "connect-client-jdbc/testOnly org.apache.spark.sql.connect.client.jdbc.SparkConnectJdbcDataTypeSuite"
In this file
./target/unit-tests.log

Was this patch authored or co-authored using generative AI tooling?

No.

@cloud-fan
Copy link
Contributor

thanks, merging to master/4.1!

@cloud-fan cloud-fan closed this in 0790fff Dec 3, 2025
cloud-fan pushed a commit that referenced this pull request Dec 3, 2025
…erver output stream to files

### What changes were proposed in this pull request?

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 enables log4j logging for Test Spark Connect server in all test modes (both debug and non-debug) by always configuring log4j2.properties.

### Why are the changes needed?

When `SPARK_DEBUG_SC_JVM_CLIENT=false`
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 log4j files

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Tested and confirmed that  log files are created  when

1) `SPARK_DEBUG_SC_JVM_CLIENT=false  build/sbt "connect-client-jdbc/testOnly org.apache.spark.sql.connect.client.jdbc.SparkConnectJdbcDataTypeSuite"`

OR

2) `SPARK_DEBUG_SC_JVM_CLIENT=true  build/sbt "connect-client-jdbc/testOnly org.apache.spark.sql.connect.client.jdbc.SparkConnectJdbcDataTypeSuite"`
```
In this file
./target/unit-tests.log
```
### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #53275 from vinodkc/br_redirect_stdout_stderr_to_file.

Authored-by: vinodkc <vinod.kc.in@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 0790fff)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@dongjoon-hyun
Copy link
Member

Thank you, @vinodkc and all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants