hutiefang76 opened a new pull request, #423: URL: https://github.com/apache/commons-net/pull/423
A lost ACK currently makes `TFTPClient.sendFile` wait repeatedly without resending the outstanding packet. Retry the current write request or DATA packet after a receive timeout, keeping the existing retry limit. The pending DATA payload shares the buffered-send array. Send an unexpected-TID error through the unbuffered path so that answering another peer cannot overwrite the data needed for a later retry. The new real loopback UDP tests cover empty, full-block and multi-block uploads, lost write-request/intermediate/final ACKs, byte-identical retransmission, logical byte counts, and an intervening unexpected-TID reply. Sockets use ephemeral ports and bounded waits, with explicit cleanup. Fixes [NET-640](https://issues.apache.org/jira/browse/NET-640). Validation: - Original production: the 11-case upload matrix passed four controls and failed seven dropped-ACK cases with the expected timeout. A retry-only patch failed the additional wrong-TID payload check (first byte expected 3, received 85). - Final patch: all 12 UDP cases passed on macOS with JDK 21.0.10. - Complete default Maven goals passed on Linux arm64, Temurin 21.0.9+10 and Maven 3.9.11: 644 cases, 642 passed, two existing disabled timestamp-parser tests, zero failures/errors. RAT, Javadoc, Checkstyle, coverage, changes validation, binary compatibility and PMD checks passed. - On macOS, the default build failed in the unmodified `SocketClientTest.testConnectUnresolved` and `TestConnectTimeout`; both also failed with original production source. Both pristine controls and the complete final build passed in the isolated Linux environment. <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> Thanks for your contribution to [Apache Commons](https://commons.apache.org/)! Your help is appreciated! Before you push a pull request, review this list: - [x] Read the [contribution guidelines](CONTRIBUTING.md) for this project. - [x] Read the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) if you use Artificial Intelligence (AI). - [x] I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute? - [x] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself. - [x] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process. AI assistance: DeepSeek Pro drafted implementation/tests and reviewed the patch; Codex coordinated native validation and refined setup, scope and formatting. -- 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]
