Repository navigation
Conversation
…k and test the close-during-write path
cf5356f to
c5d3295
Compare
|
Thank you @cravani and @gengliangwang! |
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Thank you for the fix, @cravani. I reviewed the latest commit, c5d3295, and left 9 inline comments. Here is a summary, ordered by priority.
Logging on the event loop
FileDownloadCallbackL453: the no-logging rule only sits inonData, butonFailureis where SPARK-38446 removed the same kind of log. A class-level comment citing SPARK-38446 would cover all three callbacks.FileDownloadCallbackL454: the root cause is that the files-client event loop can inherit anExecutorClassLoaderas its context class loader, and network-common still logs throwables on it. This could be fixed indownloadClient(L406) under a separate JIRA.
Tests
FileDownloadCallbackL461: no test covers theif !source.isOpen()guard, so dropping it would let real sink failures truncate downloads silently.NettyRpcEnvSuiteL324:assert(!buf.hasRemaining)pins a detail that no caller relies on, and L325-327 only check thatonDatadoes not throw.NettyRpcEnvSuiteL288:clientMode = trueis enough, since the transport is mocked.NettyRpcEnvSuiteL287: the new test, and the three from #59472, could use theSPARK-60246:prefix.
Cleanup
NettyRpcEnvSuiteL312-317:JavaUtils.readFullydoes the same.NettyRpcEnvSuiteL296: optionally,private[netty]on the two classes would let the test build the callback directly.
PR description
NettyRpcEnvSuiteL290: "never reaches thecatch" overstates,AutoNettyRpcEnvSuiteis missing, and the AI section lacks theGenerated-by:phrase.
Items 1 and 3 are the ones I'd like to see in this PR. Item 2 can be a follow-up JIRA, and the rest are nits. Since #59472 is also in branch-4.x, this follow-up should go there too; it applies cleanly.
|
Thanks for the detailed review, @dongjoon-hyun I've tried addressing 1 and 3 through 9 in the latest commit, will open a separate Jira for 2 once this is fixed. |
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Thank you for addressing items 1 and 3-9, @cravani. I reviewed the latest commit, c214a92, and left 4 inline comments. Here is a summary, ordered by priority, continuing the numbering from items 1-9.
Tests
NettyRpcEnvSuiteL342: the no-log check never callsonFailure, where SPARK-38446 removed the original log, so adding that log back would keep the test green.NettyRpcEnvSuiteL346:sourceandotherSourceare closed only on the success path, so a failed assertion leaves both pipes open.NettyRpcEnvSuiteL348: the assertion counts every event on theNettyRpcEnvlogger from any thread, including the suite's sharedenv, not only the callbacks.NettyRpcEnvSuiteL323: the blocking write runs onExecutionContext.global, which is never shut down and is not inThreadAudit's allow-list.
Item 10 is the one I'd like to see in this PR, since it closes the gap that item 1 was about. The rest are nits.
|
Thanks again @dongjoon-hyun for the review. I've updated changes on latest commit for 10-13. I also renamed the new test, since it now covers more than the close-during-write case. |
|
Hello @dongjoon-hyun I wanted to check if you had a chance to go by the latest change any feedbacks? |
…k and test the close-during-write path ### What changes were proposed in this pull request? Follow-up to #59472. - `FileDownloadCallback` no longer logs. Its callbacks run on the files-client event loop, and logging there can block on a class loader that is itself waiting on that event loop, for example `ExecutorClassLoader` fetching a class over the same connection (SPARK-38446). A class-level comment on `FileDownloadCallback` now states this rule for all of its callbacks. The `discarding` flag only existed to log once, so it is removed too. - The file download tests in `NettyRpcEnvSuite` set `spark.files.io.numConnectionsPerPeer` to 1, so the downloads in a test always share one connection. They are also prefixed with `SPARK-60246: `. - New test `SPARK-60246: download callbacks drop data for a closed reader, report other failures, and do not log`. It gets the real callbacks through a mocked download client and checks three cases: - When the reader closes while `onData` is blocked in the pipe write, `onData` returns without throwing, and later data for that stream is dropped. - When the sink fails while the reader is still open, `onData` throws `ClosedChannelException`, so a real write failure is not hidden as a truncated download. - When the stream fails, `onFailure` passes its exact error to the reader. It also checks that the callbacks log nothing. ### Why are the changes needed? #59472 added debug logs on the files-client event loop, which can deadlock as described above. Its early-close test closes the reader before data arrives, so it does not reliably reach the `catch` for a reader that closes during a write. No test covered the `!source.isOpen()` guard on that `catch`. The tests also relied on the default of one connection per peer. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Ran the `SPARK-60246` tests in `NettyRpcEnvSuite`, `SslNettyRpcEnvSuite`, and `AutoNettyRpcEnvSuite`. The new test fails if the `catch` guard in `onData` is narrowed to `case _: IOException =>`, if `onFailure` stops passing its error to the reader, or if a callback logs. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Opus 5.5 Closes #59532 from cravani/followup-spark-60246. Authored-by: Chiran Ravani <chiran54321@gmail.com> Signed-off-by: Gengliang Wang <gengliang@apache.org> (cherry picked from commit 415b032) Signed-off-by: Gengliang Wang <gengliang@apache.org>
What changes were proposed in this pull request?
Follow-up to #59472.
FileDownloadCallbackno longer logs. Its callbacks run on the files-client event loop, and logging there can block on a class loader that is itself waiting on that event loop, for exampleExecutorClassLoaderfetching a class over the same connection (SPARK-38446). A class-level comment onFileDownloadCallbacknow states this rule for all of its callbacks. Thediscardingflag only existed to log once, so it is removed too.The file download tests in
NettyRpcEnvSuitesetspark.files.io.numConnectionsPerPeerto 1, so the downloads in a test always share one connection. They are also prefixed withSPARK-60246:.New test
SPARK-60246: download callbacks drop data for a closed reader, report other failures, and do not log. It gets the real callbacks through a mocked download client and checks three cases:onDatais blocked in the pipe write,onDatareturns without throwing, and later data for that stream is dropped.onDatathrowsClosedChannelException, so a real write failure is not hidden as a truncated download.onFailurepasses its exact error to the reader.It also checks that the callbacks log nothing.
Why are the changes needed?
#59472 added debug logs on the files-client event loop, which can deadlock as described above. Its early-close test closes the reader before data arrives, so it does not reliably reach the
catchfor a reader that closes during a write. No test covered the!source.isOpen()guard on thatcatch. The tests also relied on the default of one connection per peer.Does this PR introduce any user-facing change?
No
How was this patch tested?
Ran the
SPARK-60246tests inNettyRpcEnvSuite,SslNettyRpcEnvSuite, andAutoNettyRpcEnvSuite. The new test fails if thecatchguard inonDatais narrowed tocase _: IOException =>, ifonFailurestops passing its error to the reader, or if a callback logs.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5