nzw921rx opened a new issue, #13452:
URL: https://github.com/apache/seatunnel/issues/13452

   ### Search before asking
   
   - [x] I searched the existing issues for this specific reconnect behavior. 
The related recovery issue is #12713.
   
   ### What happened
   
   The WebSocket source can retry indefinitely when each handshake completes 
but `WebSocket.send()` rejects an `open_messages` payload. This is a follow-up 
to #12716. [Review 
finding](https://github.com/apache/seatunnel/pull/12716#pullrequestreview-5526411828)
   
   1. Enable reconnect with a small positive limit and configure an open 
message.
   2. In a controlled test, complete the handshake on each attempt and make 
`send()` return `false` for the open message.
   3. `onOpen()` resets the reconnect counter before sending the message. The 
connector cancels the socket on rejection, and `onDisconnected()` schedules 
another retry from the reset counter. [Open 
callback](https://github.com/apache/seatunnel/blob/950f334c5f7e855eed358408f6a6332a920567ee/seatunnel-connectors-v2/connector-websocket/src/main/java/org/apache/seatunnel/connectors/seatunnel/websocket/source/WebSocketSourceClient.java#L270)
 ยท [Retry 
limit](https://github.com/apache/seatunnel/blob/950f334c5f7e855eed358408f6a6332a920567ee/seatunnel-connectors-v2/connector-websocket/src/main/java/org/apache/seatunnel/connectors/seatunnel/websocket/source/WebSocketSourceClient.java#L184)
   
   A related error-reporting case occurs if an attempt rejects an open message 
and the final attempt fails before `onOpen()`. The stored send error from the 
earlier connection can become the terminal error's message. [Error 
handling](https://github.com/apache/seatunnel/blob/950f334c5f7e855eed358408f6a6332a920567ee/seatunnel-connectors-v2/connector-websocket/src/main/java/org/apache/seatunnel/connectors/seatunnel/websocket/source/WebSocketSourceClient.java#L225)
   
   ### Expected behavior
   
   - Count consecutive failed open-message sends toward `max_reconnect_times` 
and surface a terminal error when the retry budget is exhausted.
   - When the final attempt fails before the handshake completes, report that 
failure as the terminal error.
   - Cover both cases in the WebSocket source tests. The existing reader test 
covers a successful recovery after the first connection drops. [Existing 
test](https://github.com/apache/seatunnel/blob/950f334c5f7e855eed358408f6a6332a920567ee/seatunnel-connectors-v2/connector-websocket/src/test/java/org/apache/seatunnel/connectors/seatunnel/websocket/source/WebSocketSourceReaderTest.java#L325)
   
   ### SeaTunnel Version
   
   `dev` at `950f334c5f7e`, including #12716.
   
   ### SeaTunnel Config
   
   ```conf
   enable_reconnect = true
   max_reconnect_times = 2
   open_messages = ["subscribe"]
   ```
   
   ### Running Command
   
   Exercise the callback sequence described above in the WebSocket source 
reader test.
   
   ### Error Exception
   
   From source inspection, repeated rejection can keep the task reconnecting at 
attempt `1/2` without reaching the terminal error.
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct).
   


-- 
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]

Reply via email to