cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Weird ftp transfer error on Windows

From: Alessandro Vesely <vesely_at_tana.it>
Date: Mon, 11 Jun 2007 12:24:11 +0200

Daniel Stenberg wrote:
> On Sat, 9 Jun 2007, Alessandro Vesely wrote:
>
>> A couple of days ago, a few dozens of files did not pass from one client.
>
> [...]
>
>> The problem is on the client, because it only happened on that PC. In
>> facts, the poor machine had a huge amount of opened handles and was
>> working badly. Our best bet is that curl encountered a critical error
>> and was terminated.
>
> In other words: you have no idea what happened, and a very far-fetched
> long-shot guess is this?

Yes, it actually is :-) I don't have access to that machine.

>> Because the calling batch is called from a service, it was not
>> interactive.
>> Perhaps, if it were interactive it could have shown a message like
>>
>> "The application failed to initialize properly (0xC0000017).
>> Click OK to terminate the application."
>
> No, curl never displays anything like that.

It is what happens if there's not enough memory. I haven't been able
to reproduce the on-site failure, but I forged curl.exe's PE header
setting high numbers for reserved and committed heap and stack values,
so as to simulate a pathological shortage of memory without actually
killing my machine.

> If it fails internally, it
> returns an error back and displays an error message. Which should be
> enough for every script/batch file to show and/or catch.

Yup, that's why I like it. In the nearly-short-of-memory case, I got
"curl: (7) Failed to connect to 10.20.30.40: No buffer space".

I wrote in case someone knows about other possible "external" failures.
I mean pathological system circumstances similar to the one I tried to
reproduce.

FWIW, I found a better idiom than the double dutch transfer I mentioned
in my previous post:

  if exist curl-trace del curl-trace
  curl --trace-ascii curl-trace [...]
  if errorlevel 1 goto failure
  if not exist curl-trace goto failure2
  ...

This fails correctly with that forged curl.exe: if the machine is short
of memory you get the system message box (or no warning from AT jobs)
and then go to failure2. Windows can abort your process and return an
error level (a.k.a. exit status) of 0 --that was with XP sp2.

Thank you for your time
Ale
Received on 2007-06-11