Re: [squid-users] Ftp put gives bad gateway but put is correct

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sat, 02 Aug 2008 02:00:52 +1200

David Rodríguez Fernández wrote:
> /usr/local/squid/var/logs# grep -B 10 -A 10 "Got code 150 after
> sending data" cache.log
> 2008/08/01 11:48:38.869| 150 Sending file to /home/path/tmpdir/README
> 2008/08/01 11:48:38.869| handleControlReply: state=13, code=150
> 2008/08/01 11:48:38.869| This is ftpReadStor
> 2008/08/01 11:48:38.869| ftpReadStor: starting data transfer
> 2008/08/01 11:48:38.869| Server.cc(363) will write 713 request body bytes
> 2008/08/01 11:48:38.869| ftpReadStor: writing data channel
> 2008/08/01 11:48:38.869| Server.cc(269) waiting for request body write
> to complete
> 2008/08/01 11:48:38.869| Server.cc(279) waiting for request body write
> to complete
> 2008/08/01 11:48:38.869| ftp.cc(3355) doneSendingRequestBody
> 2008/08/01 11:48:38.869| This is ftpWriteTransferDone
> 2008/08/01 11:48:38.869| ftpReadTransferDone: Got code 150 after sending data
> 2008/08/01 11:48:38.869| ftp.cc(3380) closing FTP server FD 20, Data
> FD 21, this 0x2b2685713028
> 2008/08/01 11:48:38.869| ~ftpStateData:
> ftp://ssssss:xxxxxx@ftp.server/./tmpdir/README
>

Ah, I've checked the code over quickly and I think I see a problem:

The writing process doneSendingRequestBody calls the
ftpWriteTransferDone callback synchronously after the last byte is
written but before the server has sent 250 result. I believe it should
be only cleaning up after the transfer and returning, at most possibly
scheduling a read/watch on the control channel.
The control channel read handler looks like it can deal with things
properly from there when the 250 completed message actually comes in.

I'm busy for a few days. But will get onto this when I am free again if
its not resolved by someone else beforehand.
Please log a bug report with these details so it does not get lost.

Amos
>
>
> On Fri, Aug 1, 2008 at 9:27 AM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
>> David Rodríguez Fernández wrote:
>>> Nobody know how to resolve this issue? This is an squid issue? I think
>>> this is an squid error, no?
>> I've checked the squid code and it should be handling both.
>>
>> What does the cache.log lines about 10 before/after "ftpReadTransferDone:
>> Got code 150 after sending data" contain?
>>
>> configure "debug_options ALL,1 9,8" for more details.
>>
>> Amos
>>
>>> On Tue, Jul 29, 2008 at 10:58 AM, David Rodríguez Fernández
>>> <davidrf_at_gmail.com> wrote:
>>>> Ok, I'm upgraded to version squid/3.0.STABLE8 and I still have the same
>>>> error.
>>>>
>>>> The cache.log says: ftpReadTransferDone: Got code 150 after sending data
>>>> And if I try to debug the conexion data, I get this:
>>>>
>>>> [...]
>>>> T proxy:56819 -> remote:21 [AP]
>>>> CWD /path..
>>>> #
>>>> T remote:21 -> proxy:56819 [AP]
>>>> 250 "/path" is current directory...
>>>> #
>>>> T proxy:56819 -> remote:21 [AP]
>>>> MDTM README..
>>>> #
>>>> T remote:21 -> proxy:56819 [AP]
>>>> 500 Subcommand MDTM not valid...
>>>> #
>>>> T proxy:56819 -> remote:21 [AP]
>>>> PASV..
>>>> #
>>>> T remote:21 -> proxy:56819 [AP]
>>>> 227 Entering Passive Mode (remote)...
>>>> ####
>>>> T proxy:56819 -> remote:21 [AP]
>>>> STOR README..
>>>> #
>>>> T remote:21 -> proxy:56819 [AP]
>>>> 150 Sending file to /path//README..
>>>> #
>>>> T proxy:52215 -> remote:32795 [AP]
>>>> FILE DATA FILE DATA FILE DATA FILE DATA FILE DATA FILE DATA
>>>> FILE DATA FILE DATA FILE DATA FILE DATA FILE DATA FILE DATA
>>>> FILE DATA FILE DATA FILE DATA FILE DATA FILE DATA FILE DATA
>>>> #######
>>>> T remote:21 -> proxy:56819 [AP]
>>>> 250 File transfer completed successfully...
>>>> ##
>>>> T remote:21 -> proxy:56819 [AFP]
>>>> 221 QUIT subcommand received...
>>>> #exit
>>>>
>>>> That is an correct transfer. But squid only logs the 150 response not the
>>>> 250.
>>>>
>>>>> On Wed, Jul 23, 2008 at 3:20 PM, Amos Jeffries <squid3_at_treenet.co.nz>
>>>>> wrote:
>>>>>> David Rodríguez Fernández wrote:
>>>>>>> Hi list.
>>>>>>>
>>>>>>> I'm having an issue with a ftp server. When I put a file in the remote
>>>>>>> server Squid gives me an "502 Bad Gateway" error, and the error
>>>>>>> message gives
>>>>>>> me this:
>>>>>>>
>>>>>>>> ERROR
>>>>>>>> FTP PUT/upload failed
>>>>>>>> While trying to PUT the following URL:
>>>>>>>> ftp://user@hostname-ipaddress/path/file.txt
>>>>>>>> Squid sent the following FTP command:
>>>>>>>> STOR file.txt
>>>>>>>> and then received this reply.
>>>>>>>> File transfer completed successfully
>>>>>>>> This means that:
>>>>>>>> Check path, permissions, diskspace and try again
>>>>>>> But the file is corrected uploaded in the server. This is annoying,
>>>>>>> because I have an automated task that fail with this error message.
>>>>>>>
>>>>>>> I have squid 2.5 in Linux and the remote server is an AS400.
>>>>>> The logic in your squid may be bad. 2.5 is obsolete now for some years.
>>>>>> Try upgrading.
>>>>>>
>>>>>> Amos
>>>>>> --
>>>>>> Please use Squid 2.7.STABLE3 or 3.0.STABLE8
>>>>>
>>>>> --
>>>>> Yo he notado el calentamiento global en los rumanos de mi pueblo. Antes
>>>>> se tomaban el cońac solo y ahora le echan hielo.
>>>>>
>>>>> Dr. Sonao. Julio de 2008
>>>>
>>>> --
>>>> Yo he notado el calentamiento global en los rumanos de mi pueblo.
>>>> Antes se tomaban el cońac solo y ahora le echan hielo.
>>>>
>>>> Dr. Sonao. Julio de 2008
>>>
>>>
>>> --
>>> Yo he notado el calentamiento global en los rumanos de mi pueblo.
>>> Antes se tomaban el cońac solo y ahora le echan hielo.
>>>
>>> Dr. Sonao. Julio de 2008
>>
>> --
>> Please use Squid 2.7.STABLE3 or 3.0.STABLE8
>>
>
>
>

-- 
Please use Squid 2.7.STABLE3 or 3.0.STABLE8
Received on Fri Aug 01 2008 - 14:00:52 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 04 2008 - 12:00:03 MDT