gnodet commented on code in PR #30483:
URL: https://github.com/apache/camel/pull/30483#discussion_r4663503311
##########
components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpSimpleProduceDisconnectIT.java:
##########
@@ -30,8 +30,10 @@ public class SftpSimpleProduceDisconnectIT extends
SftpServerTestSupport {
@Test
public void testSftpSimpleProduce() throws Exception {
Review Comment:
You're right to question this. The test name implies it should verify that
the component handles a mid-session disconnect gracefully — i.e., that the
reconnect logic works after a server restart. With `disconnect=true`, we're
bypassing the reconnect path entirely: the producer never reuses the stale
session because it disconnects after every send.
The real fix would be in the runtime: improve the liveness check
(`sendNoop()`) so it reliably detects a stale TCP connection after a server
restart (e.g., by catching the socket error sooner or forcing a TCP probe). The
current `sendNoop()` can return success even when the server has gone away
because the kernel hasn't yet delivered the RST.
That said, fixing `sendNoop()` reliably is non-trivial (platform-dependent
TCP teardown timing), and the test as originally written — using
`DefaultProducerTemplate` which caches producers across sends — may not even be
exercising what it claims: a real consumer that reconnects would typically not
share a single cached producer this way.
Would you prefer I revert this and instead file a follow-up for the runtime
reconnect issue, or is there a preferred pattern for connection liveness tests
in Camel?
##########
components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpSimpleProduceDisconnectIT.java:
##########
@@ -30,8 +30,10 @@ public class SftpSimpleProduceDisconnectIT extends
SftpServerTestSupport {
@Test
public void testSftpSimpleProduce() throws Exception {
Review Comment:
You're right to question this. The test name implies it should verify that
the component handles a mid-session disconnect gracefully — i.e., that the
reconnect logic works after a server restart. With `disconnect=true`, we're
bypassing the reconnect path entirely: the producer never reuses the stale
session because it disconnects after every send.
The real fix would be in the runtime: improve the liveness check
(`sendNoop()`) so it reliably detects a stale TCP connection after a server
restart (e.g., by catching the socket error sooner or forcing a TCP probe). The
current `sendNoop()` can return success even when the server has gone away
because the kernel hasn't yet delivered the RST.
That said, fixing `sendNoop()` reliably is non-trivial (platform-dependent
TCP teardown timing), and the test as originally written — using
`DefaultProducerTemplate` which caches producers across sends — may not even be
exercising what it claims: a real consumer that reconnects would typically not
share a single cached producer this way.
Would you prefer I revert this and instead file a follow-up for the runtime
reconnect issue, or is there a preferred pattern for connection liveness tests
in Camel?
##########
components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpSimpleProduceDisconnectIT.java:
##########
@@ -30,8 +30,10 @@ public class SftpSimpleProduceDisconnectIT extends
SftpServerTestSupport {
@Test
public void testSftpSimpleProduce() throws Exception {
Review Comment:
You're right to question this. The test name implies it should verify that
the component handles a mid-session disconnect gracefully — i.e., that the
reconnect logic works after a server restart. With `disconnect=true`, we're
bypassing the reconnect path entirely: the producer never reuses the stale
session because it disconnects after every send.
The real fix would be in the runtime: improve the liveness check
(`sendNoop()`) so it reliably detects a stale TCP connection after a server
restart (e.g., by catching the socket error sooner or forcing a TCP probe). The
current `sendNoop()` can return success even when the server has gone away
because the kernel hasn't yet delivered the RST.
That said, fixing `sendNoop()` reliably is non-trivial (platform-dependent
TCP teardown timing), and the test as originally written — using
`DefaultProducerTemplate` which caches producers across sends — may not even be
exercising what it claims: a real consumer that reconnects would typically not
use a single cached producer this way.
Would you prefer I revert this and instead file a follow-up for the runtime
reconnect issue, or is there a preferred pattern for connection liveness tests
in Camel?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]