comp.lang.ada
 help / color / mirror / Atom feed
* Interesting AWS error.
@ 2014-12-10  5:15 Shark8
  2014-12-10  8:43 ` Dmitry A. Kazakov
  2014-12-10 12:34 ` Pascal Obry
  0 siblings, 2 replies; 10+ messages in thread
From: Shark8 @ 2014-12-10  5:15 UTC (permalink / raw)


I'm running AWS on windows, built with Pascal's now-disappeared* .bat 
file and [IIRC] with SSL support. I'm getting the following when I try 
feeding an https protocol URL to the AWS.Client.Get subprogram:

raised PROGRAM_ERROR : aws-client.adb:317 finalize/adjust raised exception

The indicated line seems to be a declare-block, literally the word 
'declare'... which makes the PROGRAM_ERROR itself puzzling to me. I 
didn't think that the declare itself could raise PROGRAM_ERROR... or 
that it would be flagged as the trouble-spot.

-------------
* It used to be in the git repo, but I foolishly updated and it was 
deleted. :(  -- If anyone has a copy it would be most appreciated.

-------------

299   function Get
300     (URL                : String;
301      User               : String          := No_Data;
302      Pwd                : String          := No_Data;
303      Proxy              : String          := No_Data;
304      Proxy_User         : String          := No_Data;
305      Proxy_Pwd          : String          := No_Data;
306      Timeouts           : Timeouts_Values := No_Timeout;
307      Data_Range         : Content_Range   := No_Range;
308      Follow_Redirection : Boolean         := False;
309      Certificate        : String          := Default.Client_Certificate;
310      Headers            : Header_List     := Empty_Header_List)
311      return Response.Data
312   is
313      use type Messages.Status_Code;
314
315      Result : Response.Data;
316   begin
317      declare
318         Connection : HTTP_Connection;
319      begin
320         Create (Connection,
321                 URL, User, Pwd, Proxy, Proxy_User, Proxy_Pwd,
322                 Persistent  => False,
323                 Certificate => Certificate,
324                 Timeouts    => Timeouts);
325
326         Get (Connection, Result,
327              Data_Range => Data_Range, Headers => Headers);
328
329         Close (Connection);
330      exception
331         when others =>
332            Close (Connection);
333            raise;
334      end;
335
336      declare
337         SC : constant Messages.Status_Code := Response.Status_Code 
(Result);
338      begin
339         if Follow_Redirection and then SC = Messages.S305 then
340            --  This is "Use Proxy" message, Location point to the 
proxy to
341            --  use. We do not have the login/password for the proxy.
342            return Get
343              (URL, User, Pwd, Response.Location (Result),
344               Timeouts           => Timeouts,
345               Follow_Redirection => Follow_Redirection,
346               Certificate        => Certificate);
347
348         elsif Follow_Redirection
349           and then SC in Messages.Redirection
350           and then SC /= Messages.S300 -- multiple choices
351           and then SC /= Messages.S304 -- not modified, no redirection
352         then
353            return Get
354              (Response.Location (Result), User, Pwd,
355               Proxy, Proxy_User, Proxy_Pwd, Timeouts,
356               Data_Range, Follow_Redirection, Certificate => 
Certificate);
357         else
358            return Result;
359         end if;
360      end;
361   end Get;


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Interesting AWS error.
  2014-12-10  5:15 Interesting AWS error Shark8
@ 2014-12-10  8:43 ` Dmitry A. Kazakov
  2014-12-10 15:26   ` Shark8
  2014-12-10 12:34 ` Pascal Obry
  1 sibling, 1 reply; 10+ messages in thread
From: Dmitry A. Kazakov @ 2014-12-10  8:43 UTC (permalink / raw)


On Tue, 09 Dec 2014 22:15:16 -0700, Shark8 wrote:

> I'm running AWS on windows, built with Pascal's now-disappeared* .bat 
> file and [IIRC] with SSL support. I'm getting the following when I try 
> feeding an https protocol URL to the AWS.Client.Get subprogram:
> 
> raised PROGRAM_ERROR : aws-client.adb:317 finalize/adjust raised exception
> 
> The indicated line seems to be a declare-block, literally the word 
> 'declare'... which makes the PROGRAM_ERROR itself puzzling to me.

It likely is an induced error, the original one is swallowed. You should
use GNAT exception tracing in order to track the original problem down,
which could be an induced one as well.

Consider this scenario, you get an exception somewhere. That winds the
stack up. This causes some controlled object to finalize in some block. If
the exception is bad, the finalization fails [*] and a second exception is
propagated. Upon leaving Finalize that exception is converted to a third
exception, the Program_Error one. This could repeat itself many times, so
what you get could have nothing to do with the original issue at all.

---------------------------
* It is not obvious but in fact quite difficult to design Finalize in a way
to make it survive any unanticipated exception winding the stack up. The
reason for this is that it is barely testable and that complex controlled
objects are not well insulated from each other and the environment. So
interactions that happen upon normal object finalization substantially
differ from ones upon an exception propagation, especially if that comes
from a failed initialization or construction.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Interesting AWS error.
  2014-12-10  5:15 Interesting AWS error Shark8
  2014-12-10  8:43 ` Dmitry A. Kazakov
@ 2014-12-10 12:34 ` Pascal Obry
  2014-12-10 15:21   ` Shark8
  1 sibling, 1 reply; 10+ messages in thread
From: Pascal Obry @ 2014-12-10 12:34 UTC (permalink / raw)


Le mardi 09 décembre 2014 à 22:15 -0700, Shark8 a écrit : 
> I'm running AWS on windows, built with Pascal's now-disappeared* .bat 

It is build.cmd and is still there under the win32 directory at the top
of the repository.

> file and [IIRC] with SSL support. I'm getting the following when I try 
> feeding an https protocol URL to the AWS.Client.Get subprogram:
> 
> raised PROGRAM_ERROR : aws-client.adb:317 finalize/adjust raised exception

Which compiler are you using?

-- 
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://v2p.fr.eu.org
  http://www.obry.net

  gpg --keyserver keys.gnupg.net --recv-key F949BD3B



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Interesting AWS error.
  2014-12-10 12:34 ` Pascal Obry
@ 2014-12-10 15:21   ` Shark8
  2014-12-10 15:30     ` Pascal Obry
  0 siblings, 1 reply; 10+ messages in thread
From: Shark8 @ 2014-12-10 15:21 UTC (permalink / raw)


On 10-Dec-14 05:34, Pascal Obry wrote:
> Le mardi 09 décembre 2014 à 22:15 -0700, Shark8 a écrit :
>> I'm running AWS on windows, built with Pascal's now-disappeared* .bat
>
> It is build.cmd and is still there under the win32 directory at the top
> of the repository.

Well, that explains why I couldn't find it with "dir *.bat /b /s".

Thank you for the correction.

>> file and [IIRC] with SSL support. I'm getting the following when I try
>> feeding an https protocol URL to the AWS.Client.Get subprogram:
>>
>> raised PROGRAM_ERROR : aws-client.adb:317 finalize/adjust raised exception
>
> Which compiler are you using?

The 2014 Adacore GPL release.
Gnat compile --version gives:
> GNAT GPL 2014 (20140331)
> Copyright (C) 1996-2014, Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.
> There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
> URPOSE.

gcc -x Ada --version gives:
> gcc: warning: '-x Ada' after last input file has no effect
> gcc (GCC) 4.7.4 20140401 for GNAT GPL gpl-2014 (20140405)
> Copyright (C) 2012 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.
> See your AdaCore support agreement for details of warranty and support.
> If you do not have a current support agreement, then there is absolutely
> no warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Interesting AWS error.
  2014-12-10  8:43 ` Dmitry A. Kazakov
@ 2014-12-10 15:26   ` Shark8
  2014-12-10 15:41     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 10+ messages in thread
From: Shark8 @ 2014-12-10 15:26 UTC (permalink / raw)


On 10-Dec-14 01:43, Dmitry A. Kazakov wrote:
> Consider this scenario, you get an exception somewhere. That winds the
> stack up. This causes some controlled object to finalize in some block. If
> the exception is bad, the finalization fails [*] and a second exception is
> propagated. Upon leaving Finalize that exception is converted to a third
> exception, the Program_Error one. This could repeat itself many times, so
> what you get could have nothing to do with the original issue at all.

Is this problem (finalize exception propagation) due to the language, 
making it difficult/impossible to get right? Or is it due to the 
architecture of the compiler? Or is it due to the compiler's 
code-generation? {Or a combination of all the above?}

> It likely is an induced error, the original one is swallowed. You should
> use GNAT exception tracing in order to track the original problem down,
> which could be an induced one as well.

I'll see if I can get exception-tracing to work; given that the error 
w/o it points to "declare" I'm not overly confident the results will be 
sensible, but we shall see.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Interesting AWS error.
  2014-12-10 15:21   ` Shark8
@ 2014-12-10 15:30     ` Pascal Obry
  2014-12-10 16:30       ` Shark8
  0 siblings, 1 reply; 10+ messages in thread
From: Pascal Obry @ 2014-12-10 15:30 UTC (permalink / raw)


Le mercredi 10 décembre 2014 à 08:21 -0700, Shark8 a écrit : 
> The 2014 Adacore GPL release.

Ok, so maybe an issue with GNAT GPL 2014 and current AWS master. Can you
try the release-3.1 branch of AWS? I suppose the script build.cmd from
master will work with this branch. 

-- 
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://v2p.fr.eu.org
  http://www.obry.net

  gpg --keyserver keys.gnupg.net --recv-key F949BD3B


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Interesting AWS error.
  2014-12-10 15:26   ` Shark8
@ 2014-12-10 15:41     ` Dmitry A. Kazakov
  0 siblings, 0 replies; 10+ messages in thread
From: Dmitry A. Kazakov @ 2014-12-10 15:41 UTC (permalink / raw)


On Wed, 10 Dec 2014 08:26:29 -0700, Shark8 wrote:

> On 10-Dec-14 01:43, Dmitry A. Kazakov wrote:
>> Consider this scenario, you get an exception somewhere. That winds the
>> stack up. This causes some controlled object to finalize in some block. If
>> the exception is bad, the finalization fails [*] and a second exception is
>> propagated. Upon leaving Finalize that exception is converted to a third
>> exception, the Program_Error one. This could repeat itself many times, so
>> what you get could have nothing to do with the original issue at all.
> 
> Is this problem (finalize exception propagation) due to the language, 
> making it difficult/impossible to get right? Or is it due to the 
> architecture of the compiler? Or is it due to the compiler's 
> code-generation? {Or a combination of all the above?}

It is a combination. There is really little to do when an exception is
propagated out of Finalize. Maybe it should rather abort the task at once
than rolling the snowball. And exceptions lacking contracts making it
difficult to detect the cases when Finalize is not exception-safe. This
hits me very often.

>> It likely is an induced error, the original one is swallowed. You should
>> use GNAT exception tracing in order to track the original problem down,
>> which could be an induced one as well.
> 
> I'll see if I can get exception-tracing to work; given that the error 
> w/o it points to "declare" I'm not overly confident the results will be 
> sensible, but we shall see.

See GNAT.Exception_Traces. It is a very helpful thing. Then, AWS is not
your code, but in critical parts of your code, you can also make use of
GNAT.Most_Recent_Exception. E.g. when you enter a Finalize, you can log the
exception occurrence which caused the object to go away.

Of course, it is all GNAT-specific.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Interesting AWS error.
  2014-12-10 15:30     ` Pascal Obry
@ 2014-12-10 16:30       ` Shark8
  2014-12-10 19:39         ` Shark8
  0 siblings, 1 reply; 10+ messages in thread
From: Shark8 @ 2014-12-10 16:30 UTC (permalink / raw)


On 10-Dec-14 08:30, Pascal Obry wrote:
> Le mercredi 10 décembre 2014 à 08:21 -0700, Shark8 a écrit :
>> The 2014 Adacore GPL release.
>
> Ok, so maybe an issue with GNAT GPL 2014 and current AWS master. Can you
> try the release-3.1 branch of AWS? I suppose the script build.cmd from
> master will work with this branch.
>

The output of ./win32/build.cmd C:/Proramming/GNAT/2014 is as follows:
         1 file(s) copied.
object directory 
"C:\Programming\Libraries\aws\config\..\.build\win\setup\obj\"
created
gcc -c xoscons.adb
gcc -c xutil.adb
gprbind xoscons.bexch
gnatbind xoscons.ali
gcc -c b__xoscons.adb
gcc xoscons.o -o xoscons.exe
LIBZ_Path := Project'Project_Dir
The system cannot find the path specified.
crypto_lib.gpr:43:37: wrong expression kind for attribute "library_name"
crypto_lib.gpr:43:52: unknown variable "S_Gcr_Lib"
crypto_lib.gpr:45:37: wrong expression kind for attribute "library_name"
crypto_lib.gpr:45:52: unknown variable "R_Gcr_Lib"
gprbuild: "tools/tools.gpr" processing failed
Couldn't build or install AWS


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Interesting AWS error.
  2014-12-10 16:30       ` Shark8
@ 2014-12-10 19:39         ` Shark8
  2014-12-10 21:11           ` Pascal Obry
  0 siblings, 1 reply; 10+ messages in thread
From: Shark8 @ 2014-12-10 19:39 UTC (permalink / raw)


On 10-Dec-14 09:30, Shark8 wrote:
> On 10-Dec-14 08:30, Pascal Obry wrote:
>> Le mercredi 10 décembre 2014 à 08:21 -0700, Shark8 a écrit :
>>> The 2014 Adacore GPL release.
>>
>> Ok, so maybe an issue with GNAT GPL 2014 and current AWS master. Can you
>> try the release-3.1 branch of AWS? I suppose the script build.cmd from
>> master will work with this branch.
>>

I solved the problem by altering build.cmd w/ the following lines (just 
before the line starting "echo LIBZ_Path"):

> ECHO R_GCR_Lib := ""; >> aws_lib_shared.gpr
> ECHO S_GCR_Lib := ""; >> aws_lib_shared.gpr

Now we have a nice long list of compiling files [which is good] that 
stops with

> exec directory "C:\Programming\Libraries\aws\docs\..\.build\win\common\bin" crea
> ted for project docs
> regtests.gpr:19:09: warning: no compiler specified for language "Python", ignori
> ng all its sources
> gcc -c mzlib.adb
> gcc -c foo.ads
> gcc -c stack_size.ads
> gcc -c get_free_port.adb
> get_free_port.adb:19:06: file "aws.ads" not found
> gprbuild: *** compilation phase failed
> Couldn't build or install AWS


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Interesting AWS error.
  2014-12-10 19:39         ` Shark8
@ 2014-12-10 21:11           ` Pascal Obry
  0 siblings, 0 replies; 10+ messages in thread
From: Pascal Obry @ 2014-12-10 21:11 UTC (permalink / raw)


Le mercredi 10 décembre 2014 à 12:39 -0700, Shark8 a écrit : 
> > ECHO R_GCR_Lib := ""; >> aws_lib_shared.gpr
> > ECHO S_GCR_Lib := ""; >> aws_lib_shared.gpr
> 
> Now we have a nice long list of compiling files [which is good] that 
> stops with

Which means that build.cmd is not compatible with this older AWS
version :(

-- 
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://v2p.fr.eu.org
  http://www.obry.net

  gpg --keyserver keys.gnupg.net --recv-key F949BD3B



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-12-10 21:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10  5:15 Interesting AWS error Shark8
2014-12-10  8:43 ` Dmitry A. Kazakov
2014-12-10 15:26   ` Shark8
2014-12-10 15:41     ` Dmitry A. Kazakov
2014-12-10 12:34 ` Pascal Obry
2014-12-10 15:21   ` Shark8
2014-12-10 15:30     ` Pascal Obry
2014-12-10 16:30       ` Shark8
2014-12-10 19:39         ` Shark8
2014-12-10 21:11           ` Pascal Obry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox