TFTP file transfer fails when no options are given
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
Critical
|
Björn Tillenius |
Bug Description
When a TFTP client gives no options when requesting a file from MAAS the client is unable to to send an ACK for the first block. This results in the client and MAAS ping ponging between the client requesting the file, getting the first block, and failing to send the ACK and MAAS resending the first block. Clients which send TFTP options(e.g tsize, blksize) do not run into this problem as the negotiation of options gives MAAS enough time to open the UDP port to receive the ACK.
97da24b, which starts tracking TFTP file transfer time surfaced this bug. The following patch fixes MAAS however the underlying issue is the UDP port is not opening quick enough. A heavily loaded system without TFTP file transfer tracking would most likely run into the same issue.
diff --git a/src/provision
index a7f735c27.
--- a/src/provision
+++ b/src/provision
@@ -527,8 +527,7 @@ class TFTPService(
for address in addrs_desired - addrs_established:
if not IPAddress(
- self.port, TransferTimeTra
- interface=address)
+ self.port, TFTP(self.backend), interface=address)
Reproduction:
curl --tftp-no-options --max-time 5 tftp://
Related branches
- Alberto Donato (community): Approve
- Andres Rodriguez (community): Approve
-
Diff: 207 lines (+98/-40)2 files modifiedsrc/provisioningserver/rackdservices/tests/test_tftp.py (+79/-16)
src/provisioningserver/rackdservices/tftp.py (+19/-24)
description: | updated |
Changed in maas: | |
status: | Triaged → In Progress |
Changed in maas: | |
status: | In Progress → Fix Committed |
Changed in maas: | |
status: | Fix Committed → Fix Released |
I took a look at this, since I found it odd that we wouldn't open the UDP port quickly enough. And sure enough, that's not the problem. The problem is how we replace the read session with on that keeps track of the time. We do it too late, so it has already started when we replace it. The curl command in the description to reproduce this issue shows it clearly, since you see that the contents are actually transferred, but than it waits 5 seconds and times out.
With this diff, it seems to work correctly:
http:// paste.ubuntu. com/p/m2cfTWmVp k/