comp.lang.ada
 help / color / mirror / Atom feed
* Tasking, AWS and segmentation faults
@ 2012-04-04 16:08 tonyg
  2012-04-04 19:09 ` Vadim Godunko
  2012-04-04 20:27 ` Georg Bauhaus
  0 siblings, 2 replies; 14+ messages in thread
From: tonyg @ 2012-04-04 16:08 UTC (permalink / raw)



I have a function which is an aws response. In that function I have an array of 86400 records which are processed. I was sort of expecting an error and I got one which is 

Exception name: STORAGE_ERROR
Message: s-intman.adb:139 explicit raise

I think I need to reserve some space using the storage pragma but I am wondering if anyone experienced in using AWS  have any advice 



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

* Re: Tasking, AWS and segmentation faults
  2012-04-04 16:08 Tasking, AWS and segmentation faults tonyg
@ 2012-04-04 19:09 ` Vadim Godunko
  2012-04-04 20:27 ` Georg Bauhaus
  1 sibling, 0 replies; 14+ messages in thread
From: Vadim Godunko @ 2012-04-04 19:09 UTC (permalink / raw)


On Apr 4, 8:08 pm, tonyg <tonytheg...@gmail.com> wrote:
> I have a function which is an aws response. In that function I have an array of 86400 records which are processed. I was sort of expecting an error and I got one which is
>
> Exception name: STORAGE_ERROR
> Message: s-intman.adb:139 explicit raise
>
> I think I need to reserve some space using the storage pragma but I am wondering if anyone experienced in using AWS  have any advice

I guess that you allocate this array on stack, isn't it? You need to
allocate it using 'new' and deallocate it after use by instantiation
of Ada.Unchecked_Deallocation.



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

* Re: Tasking, AWS and segmentation faults
  2012-04-04 16:08 Tasking, AWS and segmentation faults tonyg
  2012-04-04 19:09 ` Vadim Godunko
@ 2012-04-04 20:27 ` Georg Bauhaus
  2012-04-04 21:21   ` Jeffrey Carter
  1 sibling, 1 reply; 14+ messages in thread
From: Georg Bauhaus @ 2012-04-04 20:27 UTC (permalink / raw)


On 04.04.12 18:08, tonyg wrote:
>
> I have a function which is an aws response. In that function I have an array of 86400 records which are processed. I was sort of expecting an error and I got one which is
>
> Exception name: STORAGE_ERROR
> Message: s-intman.adb:139 explicit raise
>
> I think I need to reserve some space using the storage pragma but I am wondering if anyone experienced in using AWS  have any advice


If the function "causing" the storage error is in the environment
task (main unit), you could allocate more stack space to it.
On Unix, the shell's ulimit allows adjusting the amount of stack
space available programs.
If the function is defined in some Ada task, placing pragma Storage_Size
in the task type's declaration will do the trick.
If neither solution is satisfactory, you could resort to
pointers and manual memory management; see Vadim Godunko's response.



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

* Re: Tasking, AWS and segmentation faults
  2012-04-04 20:27 ` Georg Bauhaus
@ 2012-04-04 21:21   ` Jeffrey Carter
  2012-04-05 10:38     ` tonyg
  2012-04-05 16:58     ` Pascal Obry
  0 siblings, 2 replies; 14+ messages in thread
From: Jeffrey Carter @ 2012-04-04 21:21 UTC (permalink / raw)


> On 04.04.12 18:08, tonyg wrote:
>>
>> I have a function which is an aws response. In that function I have an array
>> of 86400 records which are processed. I was sort of expecting an error and I
>> got one which is
>>
>> Exception name: STORAGE_ERROR
>> Message: s-intman.adb:139 explicit raise

Since this is an AWS response function, it's called from an AWS "slot" task. I 
don't know any way to set the stack size for these tasks, so you'll either have 
to use a different data structure [an unbounded array ("vector") would do, since 
it moves your data into the heap] or explicitly move your array into the heap.

-- 
Jeff Carter
"C++ is like jamming a helicopter inside a Miata
and expecting some sort of improvement."
Drew Olbrich
51



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

* Re: Tasking, AWS and segmentation faults
  2012-04-04 21:21   ` Jeffrey Carter
@ 2012-04-05 10:38     ` tonyg
  2012-04-05 11:03       ` Georg Bauhaus
  2012-04-05 16:58     ` Pascal Obry
  1 sibling, 1 reply; 14+ messages in thread
From: tonyg @ 2012-04-05 10:38 UTC (permalink / raw)


Thanks for your help guys its working lovely now and I know something new! 

What I did was (after reading the advice here) was I used a pointer and declared a 'new type' and then passed that pointer around.



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

* Re: Tasking, AWS and segmentation faults
  2012-04-05 10:38     ` tonyg
@ 2012-04-05 11:03       ` Georg Bauhaus
  2012-04-05 15:20         ` tonyg
  0 siblings, 1 reply; 14+ messages in thread
From: Georg Bauhaus @ 2012-04-05 11:03 UTC (permalink / raw)


On 05.04.12 12:38, tonyg wrote:
> Thanks for your help guys its working lovely now and I know something new! 
> 
> What I did was (after reading the advice here) was I used a pointer and declared a 'new type' and then passed that pointer around.

For the sake of completeness, and without knowing what
you are actually doing, so I could be quite wrong, you
can still pass Pointer.all around (or rename this and
pass it around as before).
Large arrays are typically passed around by reference.
Dereferencing keeps the impact of using pointers local,
and easy to change again, just in case.



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

* Re: Tasking, AWS and segmentation faults
  2012-04-05 11:03       ` Georg Bauhaus
@ 2012-04-05 15:20         ` tonyg
  2012-04-05 16:22           ` Simon Wright
  0 siblings, 1 reply; 14+ messages in thread
From: tonyg @ 2012-04-05 15:20 UTC (permalink / raw)


On Thursday, 5 April 2012 12:03:55 UTC+1, Georg Bauhaus  wrote:
> On 05.04.12 12:38, tonyg wrote:
> > Thanks for your help guys its working lovely now and I know something new! 
> > 
> > What I did was (after reading the advice here) was I used a pointer and declared a 'new type' and then passed that pointer around.
> 
> For the sake of completeness, and without knowing what
> you are actually doing, so I could be quite wrong, you
> can still pass Pointer.all around (or rename this and
> pass it around as before).
> Large arrays are typically passed around by reference.
> Dereferencing keeps the impact of using pointers local,
> and easy to change again, just in case.

ooh ooh I forgot to dereference it! jeepers. Thanks for that you have just extended the life of my webserver beyond a fwe requests!



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

* Re: Tasking, AWS and segmentation faults
  2012-04-05 15:20         ` tonyg
@ 2012-04-05 16:22           ` Simon Wright
  2012-04-05 17:09             ` J-P. Rosen
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Wright @ 2012-04-05 16:22 UTC (permalink / raw)


tonyg <tonythegair@gmail.com> writes:

> On Thursday, 5 April 2012 12:03:55 UTC+1, Georg Bauhaus  wrote:
>> On 05.04.12 12:38, tonyg wrote:
>> > Thanks for your help guys its working lovely now and I know
>> > something new!
>> > 
>> > What I did was (after reading the advice here) was I used a pointer
>> > and declared a 'new type' and then passed that pointer around.
>> 
>> For the sake of completeness, and without knowing what
>> you are actually doing, so I could be quite wrong, you
>> can still pass Pointer.all around (or rename this and
>> pass it around as before).
>> Large arrays are typically passed around by reference.
>> Dereferencing keeps the impact of using pointers local,
>> and easy to change again, just in case.
>
> ooh ooh I forgot to dereference it! jeepers. Thanks for that you have
> just extended the life of my webserver beyond a fwe requests!

I think you mean deallocation; and yes, indeed you should!

What Georg meant was that your called subprograms could still take array
parameters:

   type Arr is array (Natural range <>) of Thing;

   procedure Sub (A : in out Arr);

   type Arr_P is access Arr;

   Actual : Arr_P := new Arr (0 .. 65535);

   Sub (A => Actual.all);



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

* Re: Tasking, AWS and segmentation faults
  2012-04-04 21:21   ` Jeffrey Carter
  2012-04-05 10:38     ` tonyg
@ 2012-04-05 16:58     ` Pascal Obry
  2012-04-05 17:14       ` Jeffrey Carter
  1 sibling, 1 reply; 14+ messages in thread
From: Pascal Obry @ 2012-04-05 16:58 UTC (permalink / raw)



Jeffrey,

> Since this is an AWS response function, it's called from an AWS "slot"
> task. I don't know any way to set the stack size for these tasks,

You can use the Stack_Size parameter of the Start procedure or configure
the size in an AWS.Config.Object or set this value into aws.ini or
application_name.ini, no I don't think there is another way :)

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B




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

* Re: Tasking, AWS and segmentation faults
  2012-04-05 16:22           ` Simon Wright
@ 2012-04-05 17:09             ` J-P. Rosen
  0 siblings, 0 replies; 14+ messages in thread
From: J-P. Rosen @ 2012-04-05 17:09 UTC (permalink / raw)


Le 05/04/2012 18:22, Simon Wright a �crit :
> What Georg meant was that your called subprograms could still take array
> parameters:
> 
>    type Arr is array (Natural range <>) of Thing;
> 
>    procedure Sub (A : in out Arr);
> 
>    type Arr_P is access Arr;
> 
>    Actual : Arr_P := new Arr (0 .. 65535);
> 
>    Sub (A => Actual.all);

or even better:
    Actual_P : Arr_P := new Arr (0 .. 65535);
    Actual : Arr renames Actual_P.all;

   Sub (A => Actual);

and forget totally about pointers!
-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr



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

* Re: Tasking, AWS and segmentation faults
  2012-04-05 16:58     ` Pascal Obry
@ 2012-04-05 17:14       ` Jeffrey Carter
  2012-04-05 17:18         ` Pascal Obry
  0 siblings, 1 reply; 14+ messages in thread
From: Jeffrey Carter @ 2012-04-05 17:14 UTC (permalink / raw)


On 04/05/2012 09:58 AM, Pascal Obry wrote:
>
>> Since this is an AWS response function, it's called from an AWS "slot"
>> task. I don't know any way to set the stack size for these tasks,
>
> You can use the Stack_Size parameter of the Start procedure or configure
> the size in an AWS.Config.Object or set this value into aws.ini or
> application_name.ini, no I don't think there is another way :)

Good. I forgot to look at the parameters of Start. I did look in AWS.Config.Set 
and didn't see anything there.

-- 
Jeff Carter
"To Err is human, to really screw up, you need C++!"
St�phane Richard
63



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

* Re: Tasking, AWS and segmentation faults
  2012-04-05 17:14       ` Jeffrey Carter
@ 2012-04-05 17:18         ` Pascal Obry
  2012-04-05 18:30           ` Jeffrey Carter
  0 siblings, 1 reply; 14+ messages in thread
From: Pascal Obry @ 2012-04-05 17:18 UTC (permalink / raw)



Jeffrey,

> Good. I forgot to look at the parameters of Start. I did look in
> AWS.Config.Set and didn't see anything there.

There is a procedure named Line_Stack_Size in AWS.Config.Set.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B




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

* Re: Tasking, AWS and segmentation faults
  2012-04-05 17:18         ` Pascal Obry
@ 2012-04-05 18:30           ` Jeffrey Carter
  2012-04-08  8:09             ` tonyg
  0 siblings, 1 reply; 14+ messages in thread
From: Jeffrey Carter @ 2012-04-05 18:30 UTC (permalink / raw)


On 04/05/2012 10:18 AM, Pascal Obry wrote:
>
> There is a procedure named Line_Stack_Size in AWS.Config.Set.

Right. I wasn't clear what that set.

-- 
Jeff Carter
"To Err is human, to really screw up, you need C++!"
St�phane Richard
63



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

* Re: Tasking, AWS and segmentation faults
  2012-04-05 18:30           ` Jeffrey Carter
@ 2012-04-08  8:09             ` tonyg
  0 siblings, 0 replies; 14+ messages in thread
From: tonyg @ 2012-04-08  8:09 UTC (permalink / raw)


On Thursday, 5 April 2012 19:30:36 UTC+1, Jeffrey Carter  wrote:
> On 04/05/2012 10:18 AM, Pascal Obry wrote:
> >
> > There is a procedure named Line_Stack_Size in AWS.Config.Set.
> 
> Right. I wasn't clear what that set.
> 
> -- 
> Jeff Carter
> "To Err is human, to really screw up, you need C++!"
> Stéphane Richard
> 63

I think Pascal has the way I should be using. Though the pointer thing worked well too.
 Some else at a linux user group meeting pointed out very reasnably that my code to use 86400 records was probably a little dubious and I'm taking another look at this. Thing was processing speeds are so high now that this makes me lazy!



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

end of thread, other threads:[~2012-04-08  8:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04 16:08 Tasking, AWS and segmentation faults tonyg
2012-04-04 19:09 ` Vadim Godunko
2012-04-04 20:27 ` Georg Bauhaus
2012-04-04 21:21   ` Jeffrey Carter
2012-04-05 10:38     ` tonyg
2012-04-05 11:03       ` Georg Bauhaus
2012-04-05 15:20         ` tonyg
2012-04-05 16:22           ` Simon Wright
2012-04-05 17:09             ` J-P. Rosen
2012-04-05 16:58     ` Pascal Obry
2012-04-05 17:14       ` Jeffrey Carter
2012-04-05 17:18         ` Pascal Obry
2012-04-05 18:30           ` Jeffrey Carter
2012-04-08  8:09             ` tonyg

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