-----Original Message-----
From: Alexander V. Lukyanov [mailto:[email protected]]
Sent: Friday, April 16, 2010 10:53 AM
To: Rempel, Curtis SCAN-DFI 3541; [email protected]
Subject: Re: net:max-retries bug?
On Fri, Apr 16, 2010 at 08:19:27PM +0400, Alexander V. Lukyanov wrote:
> The reason is that retries variable is reset to 0 when some work is
done.
> In this case lftp assumes that if it uploaded some data to the server
> then some work is done, but this assumption is incorrect.
Could you try this patch, please?
------------------------------------------------------------------------
---
Eureka! It does indeed terminate now, the only side effect I can see is
that it actually terminates on "max-retries" + 1
For example, as shown in the log below, max-retries is set to 3 and
there are 4 retry attempts after the initial failure:
1 lftp-author-patch2 <<Ctrl-D
2 debug 10
3 set cmd:trace yes
4 set cmd:at-exit "kill all"
5 set cmd:fail-exit no
6 set cmd:move-background no
7 set cmd:save-cwd-history no
8 set cmd:save-rl-history no
9 set cmd:verbose no
10 set dns:fatal-timeout 10s
11 set ftp:passive-mode on
12 # set net:max-retries 1
13 set net:max-retries 3
14 #set net:persist-retries 1
15 #set net:reconnect-interval-base 60
16 #set net:reconnect-interval-max 60
17 #set net:reconnect-interval-multiplier 1
18 set xfer:log no
19 set cmd:trace yes
20 set cmd:default-protocol ftp
21 open ibm01 || exit 255
22 set cmd:trace no
23 user ${IDPASSWD}
24 set cmd:trace yes
25 ls > /dev/null || exit 254
26 put -a file_will_not_truncate.rpt -o
SRAYROVER/SRY260E18.S000000000 || exit 251
27 put -a file_will_not_truncate.rpt -o
SRAYROVER/SRY260E18.S000000000 || exit 251
28 put -a file_will_truncate.rpt -o
SRAYROVER/SRY260E18.S000000001 || exit 252
29 quit
30 Ctrl-D
31 notice: cannot open //.netrc: No such file or directory
32 ---- Resolving host address...
33 ---- 1 address found: 10.0.0.1
34 notice: cannot open //.netrc: No such file or directory
35 ---- dns cache hit
36 ---- Connecting to ibm01 (10.0.0.1) port 21
37 <--- 220-QTCP at IBM01.
38 <--- 220 Connection will close if idle more than 5 minutes.
39 ---> FEAT
40 <--- 211-Feature listing follows:
41 <--- AUTH TLS
42 <--- CCC
43 <--- PBSZ
44 <--- PROT
45 <--- 211 End of feature listing.
46 ---> AUTH TLS
47 <--- 431 Requested security mechanism not available at this
time.
48 ---> USER ftp1
49 <--- 331 Enter password.
50 ---> PASS mypassword
51 <--- 230 FTP1 logged on.
52 ---> PWD
53 <--- 257 "QGPL" is current library.
54 ---> PASV
55 <--- 227 Entering Passive Mode (10,0,0,1,241,42).
56 ---- Connecting data socket to (10.0.0.1) port 61738
57 ---- Data connection established
58 ---> LIST
59 <--- 125 List started.
60 ---- Got EOF on data connection
61 ---- Closing data socket
62 <--- 250 List completed.
Login validated above
63 copy: get hit eof
64 copy: waiting for put confirmation
65 copy: put confirmed store
66 copy: get is finished - all done
67 copy: get hit eof
68 copy: waiting for put confirmation
69 ---> PASV
70 <--- 227 Entering Passive Mode (10,0,0,1,161,232).
71 ---- Connecting data socket to (10.0.0.1) port 41448
72 ---- Data connection established
73 ---> ALLO 206
74 <--- 202 ALLO subcommand not required.
75 ---> STOR SRAYROVER/SRY260E18.S000000000
76 <--- 150 Sending file to member S000000000 in file SRY260E18 in
library SRAYROVER.
77 ---- Closing data socket
78 <--- 226 File transfer completed successfully.
First put succeeded as expected
79 copy: put confirmed store
80 copy: get is finished - all done
81 copy: get hit eof
82 copy: waiting for put confirmation
83 ---> PASV
84 <--- 227 Entering Passive Mode (10,0,0,1,142,2).
85 ---- Connecting data socket to (10.0.0.1) port 36354
86 ---- Data connection established
87 ---> STOR SRAYROVER/SRY260E18.S000000000
88 <--- 150 Sending file to member S000000000 in file SRY260E18 in
library SRAYROVER.
89 ---- Closing data socket
90 <--- 226 File transfer completed successfully.
Second put succeeded as expected
91 copy: put confirmed store
92 copy: get is finished - all done
93 copy: get hit eof
94 copy: waiting for put confirmation
95 ---> PASV
96 <--- 227 Entering Passive Mode (10,0,0,1,129,104).
97 ---- Connecting data socket to (10.0.0.1) port 33128
98 ---- Data connection established
99 ---> STOR SRAYROVER/SRY260E18.S000000001
100 <--- 150 Sending file to member S000000001 in file SRY260E18 in
library SRAYROVER.
101 ---- Closing data socket
102 <--- 426-Records written to file SRY260E18 in library SRAYROVER
have been truncated. Data in file may not be valid.
103 <--- 426 Data transfer ended.
Third put failed as expected and retries is no longer zero
104 try_time=1271439615, retries=-1
105 ---> TYPE I
106 <--- 200 Representation type is binary IMAGE.
107 ---> SIZE SRAYROVER/SRY260E18.S000000001
108 <--- 500 Subcommand SIZE not valid.
109 copy: get hit eof
110 copy: waiting for put confirmation
111 ---> TYPE A
112 copy: put rolled back to 0, seeking get accordingly
113 copy: get position was 217
114 copy: get hit eof
115 copy: waiting for put confirmation
116 <--- 200 Representation type is ASCII nonprint.
117 ---> PASV
118 <--- 227 Entering Passive Mode (10,0,0,1,177,144).
119 ---- Connecting data socket to (10.0.0.1) port 45456
120 ---- Data connection established
121 ---> STOR SRAYROVER/SRY260E18.S000000001
122 <--- 150 Sending file to member S000000001 in file SRY260E18 in
library SRAYROVER.
123 ---- Closing data socket
124 <--- 426-Records written to file SRY260E18 in library SRAYROVER
have been truncated. Data in file may not be valid.
125 <--- 426 Data transfer ended.
First retry failed, retries incremented from -1 to 0:
126 try_time=1271439615, retries=0
127 ---> TYPE I
128 <--- 200 Representation type is binary IMAGE.
129 copy: get hit eof
130 copy: waiting for put confirmation
131 ---> TYPE A
132 copy: put rolled back to 0, seeking get accordingly
133 copy: get position was 217
134 copy: get hit eof
135 copy: waiting for put confirmation
136 <--- 200 Representation type is ASCII nonprint.
137 ---> PASV
138 <--- 227 Entering Passive Mode (10,0,0,1,137,168).
139 ---- Connecting data socket to (10.0.0.1) port 35240
140 ---- Data connection established
141 ---> STOR SRAYROVER/SRY260E18.S000000001
142 <--- 150 Sending file to member S000000001 in file SRY260E18 in
library SRAYROVER.
143 ---- Closing data socket
144 <--- 426-Records written to file SRY260E18 in library SRAYROVER
have been truncated. Data in file may not be valid.
145 <--- 426 Data transfer ended.
Second retry failed, retries incremented from 0 to 1:
146 try_time=1271439615, retries=1
147 ---> TYPE I
148 <--- 200 Representation type is binary IMAGE.
149 copy: get hit eof
150 copy: waiting for put confirmation
151 ---> TYPE A
152 copy: put rolled back to 0, seeking get accordingly
153 copy: get position was 217
154 copy: get hit eof
155 copy: waiting for put confirmation
156 <--- 200 Representation type is ASCII nonprint.
157 ---> PASV
158 <--- 227 Entering Passive Mode (10,0,0,1,50,240).
159 ---- Connecting data socket to (10.0.0.1) port 13040
160 ---- Data connection established
161 ---> STOR SRAYROVER/SRY260E18.S000000001
162 <--- 150 Sending file to member S000000001 in file SRY260E18 in
library SRAYROVER.
163 ---- Closing data socket
164 <--- 426-Records written to file SRY260E18 in library SRAYROVER
have been truncated. Data in file may not be valid.
165 <--- 426 Data transfer ended.
Third retry failed, retries incremented from 1 to 2:
166 try_time=1271439615, retries=2
167 ---> TYPE I
168 <--- 200 Representation type is binary IMAGE.
169 copy: get hit eof
170 copy: waiting for put confirmation
171 ---> TYPE A
172 copy: put rolled back to 0, seeking get accordingly
173 copy: get position was 217
174 copy: get hit eof
175 copy: waiting for put confirmation
176 <--- 200 Representation type is ASCII nonprint.
177 ---> PASV
178 <--- 227 Entering Passive Mode (10,0,0,1,85,218).
179 ---- Connecting data socket to (10.0.0.1) port 21978
180 ---- Data connection established
181 ---> STOR SRAYROVER/SRY260E18.S000000001
182 <--- 150 Sending file to member S000000001 in file SRY260E18 in
library SRAYROVER.
183 ---- Closing data socket
184 <--- 426-Records written to file SRY260E18 in library SRAYROVER
have been truncated. Data in file may not be valid.
185 <--- 426 Data transfer ended.
Fourth retry failed, retries incremented from 2 to 3:
186 try_time=1271439615, retries=3
187 ---> TYPE I
188 <--- 200 Representation type is binary IMAGE.
189 copy: get hit eof
190 copy: waiting for put confirmation
Now we have exceeded max-retries:
191 put: Fatal error: max-retries exceeded
192 ---> QUIT
193 ---- Closing control socket
194 + set cmd:at-exit "kill all"
195 + set cmd:fail-exit no
196 + set cmd:move-background no
197 + set cmd:save-cwd-history no
198 + set cmd:save-rl-history no
199 + set cmd:verbose no
200 + set dns:fatal-timeout 10s
201 + set ftp:passive-mode on
202 + set net:max-retries 3
203 + set xfer:log no
204 + set cmd:trace yes
205 + set cmd:default-protocol ftp
206 + open ibm01
207 + set cmd:trace no
208 + ls
209 + put -a file_will_not_truncate.rpt -o
SRAYROVER/SRY260E18.S000000000
210 + put -a file_will_not_truncate.rpt -o
SRAYROVER/SRY260E18.S000000000
211 + put -a file_will_truncate.rpt -o
SRAYROVER/SRY260E18.S000000001
212 + exit 252
213 + kill all
214 echo lftp exist status $?
215 lftp exist status 252
Terminated with our defined exit status