comp.lang.ada
 help / color / mirror / Atom feed
* GNAT.Sockets Segfault in a task
@ 2005-04-03  9:16 Jean-Baptiste CAMPESATO
  2005-04-03 12:28 ` Jeff C
  2005-04-03 15:17 ` Jean-Baptiste CAMPESATO
  0 siblings, 2 replies; 7+ messages in thread
From: Jean-Baptiste CAMPESATO @ 2005-04-03  9:16 UTC (permalink / raw)


re-Hello :)
To begin my code is here : http://www.a2lf.org/chttpd/.
At httpd.adb, line 81, I've  "Message:String := String'Input(Channel);" In
a procedure called by a task. And i get a Segfault sometimes when I
receive a text from the Socket.
I already tested to make a task type reather than a task, and I've always
this problem.
Somebody know what's the problem ?
Thanks a lot.



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

* Re: GNAT.Sockets Segfault in a task
  2005-04-03  9:16 GNAT.Sockets Segfault in a task Jean-Baptiste CAMPESATO
@ 2005-04-03 12:28 ` Jeff C
  2005-04-03 12:34   ` Jean-Baptiste CAMPESATO
  2005-04-03 15:17 ` Jean-Baptiste CAMPESATO
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff C @ 2005-04-03 12:28 UTC (permalink / raw)


Jean-Baptiste CAMPESATO wrote:
> re-Hello :)
> To begin my code is here : http://www.a2lf.org/chttpd/.
> At httpd.adb, line 81, I've  "Message:String := String'Input(Channel);" In
> a procedure called by a task. And i get a Segfault sometimes when I
> receive a text from the Socket.
> I already tested to make a task type reather than a task, and I've always
> this problem.
> Somebody know what's the problem ?
> Thanks a lot.

Perhaps you are blowing the stack for the task? GNAT does not enable 
storage error for stack errors be default (you must build with 
-fstack-check).

When you made it a task type did you try setting a large stack for the 
task type?



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

* Re: GNAT.Sockets Segfault in a task
  2005-04-03 12:28 ` Jeff C
@ 2005-04-03 12:34   ` Jean-Baptiste CAMPESATO
  2005-04-03 13:28     ` Pascal Obry
  0 siblings, 1 reply; 7+ messages in thread
From: Jean-Baptiste CAMPESATO @ 2005-04-03 12:34 UTC (permalink / raw)


Le Sun, 03 Apr 2005 08:28:56 -0400, Jeff C a ᅵcritᅵ:

> Jean-Baptiste CAMPESATO wrote:
>> re-Hello :)
>> To begin my code is here : http://www.a2lf.org/chttpd/.
>> At httpd.adb, line 81, I've  "Message:String := String'Input(Channel);" In
>> a procedure called by a task. And i get a Segfault sometimes when I
>> receive a text from the Socket.
>> I already tested to make a task type reather than a task, and I've always
>> this problem.
>> Somebody know what's the problem ?
>> Thanks a lot.
> 
> Perhaps you are blowing the stack for the task? GNAT does not enable 
> storage error for stack errors be default (you must build with 
> -fstack-check).
> 
> When you made it a task type did you try setting a large stack for the 
> task type?

Hello,
with -fstack-check I got :
camje_lemon@pc3:~/prog/ada/httpd$ \_o< $./main 
Connection de 127.0.0.1:37560
 de 127.0.0.1:37560
Connection de 127.0.0.1:37562

raised STORAGE_ERROR : stack overflow detected

-----------------------------------------------
And at the first input Message is empty  :
"" de 127.0.0.1:37560
-----------------------------------------------
If nobody can help me, i will use AdaSockets :).

Thanks



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

* Re: GNAT.Sockets Segfault in a task
  2005-04-03 12:34   ` Jean-Baptiste CAMPESATO
@ 2005-04-03 13:28     ` Pascal Obry
  2005-04-03 13:35       ` Jean-Baptiste CAMPESATO
  0 siblings, 1 reply; 7+ messages in thread
From: Pascal Obry @ 2005-04-03 13:28 UTC (permalink / raw)



Jean-Baptiste CAMPESATO <camje_lemon@nospam.a2lf.org> writes:

> If nobody can help me, i will use AdaSockets :).

How strange ! I don't see why AdaSockets would solve your stack problem.

Pascal.

-- 

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



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

* Re: GNAT.Sockets Segfault in a task
  2005-04-03 13:28     ` Pascal Obry
@ 2005-04-03 13:35       ` Jean-Baptiste CAMPESATO
  0 siblings, 0 replies; 7+ messages in thread
From: Jean-Baptiste CAMPESATO @ 2005-04-03 13:35 UTC (permalink / raw)


Le Sun, 03 Apr 2005 15:28:27 +0200, Pascal Obry a ᅵcritᅵ:

> 
> Jean-Baptiste CAMPESATO <camje_lemon@nospam.a2lf.org> writes:
> 
>> If nobody can help me, i will use AdaSockets :).
> 
> How strange ! I don't see why AdaSockets would solve your stack problem.
> 
> Pascal.

Hmmmm ok.
I don't understand the problem.
-----
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16386 (LWP 14085)]
0x0804b2f7 in httpd__traitement__B_4___input28.5 () at httpd.adb:92
92                              Message:String := String'Input(Channel);
(gdb) 
-----
Somebody can explain the problem i meet ? and if possible, how to repair
it ?

Thanks.

PS: I up to date my sources.



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

* Re: GNAT.Sockets Segfault in a task
  2005-04-03  9:16 GNAT.Sockets Segfault in a task Jean-Baptiste CAMPESATO
  2005-04-03 12:28 ` Jeff C
@ 2005-04-03 15:17 ` Jean-Baptiste CAMPESATO
  2005-04-03 18:08   ` tmoran
  1 sibling, 1 reply; 7+ messages in thread
From: Jean-Baptiste CAMPESATO @ 2005-04-03 15:17 UTC (permalink / raw)


Le Sun, 03 Apr 2005 11:16:38 +0200, Jean-Baptiste CAMPESATO a ᅵcritᅵ:

> re-Hello :)
> To begin my code is here : http://www.a2lf.org/chttpd/.
> At httpd.adb, line 81, I've  "Message:String := String'Input(Channel);" In
> a procedure called by a task. And i get a Segfault sometimes when I
> receive a text from the Socket.
> I already tested to make a task type reather than a task, and I've always
> this problem.
> Somebody know what's the problem ?
> Thanks a lot.

Thanks. I resolved the problem with using STREAM :).
bye



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

* Re: GNAT.Sockets Segfault in a task
  2005-04-03 15:17 ` Jean-Baptiste CAMPESATO
@ 2005-04-03 18:08   ` tmoran
  0 siblings, 0 replies; 7+ messages in thread
From: tmoran @ 2005-04-03 18:08 UTC (permalink / raw)


> At httpd.adb, line 81, I've  "Message:String := String'Input(Channel);"
  Was the data written by a String'Output compiled by the same compiler
for the same kind of machine?  'Input expects to get first the bounds,
then the content, of the string.  The format of the bounds part is not
specified by the language, ie, it's compiler dependent.  Perhaps the
incoming data didn't contain any bounds and String'Input was interpreting
the first few characters as bounds, with disastrous result?
  If these are strings, are they from RFC 822 style data where string
termination is by CRLF?  In that case you need to do reads into a
buffer and concatenate/cut at CRLFs to make separate strings.  You
could make Channel of a child of Root_Stream_Type and write your
function RFC822_Input and "for String'Input use RFC822_Input;"

>Thanks. I resolved the problem with using STREAM :).
  Going to the low level suggests you know, independently, at least
the length of the string.  If the bounds are First and Last, you could:
declare
  Message : String(First .. Last);
begin
  String'Read(Channel, Message);
  ...



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

end of thread, other threads:[~2005-04-03 18:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-03  9:16 GNAT.Sockets Segfault in a task Jean-Baptiste CAMPESATO
2005-04-03 12:28 ` Jeff C
2005-04-03 12:34   ` Jean-Baptiste CAMPESATO
2005-04-03 13:28     ` Pascal Obry
2005-04-03 13:35       ` Jean-Baptiste CAMPESATO
2005-04-03 15:17 ` Jean-Baptiste CAMPESATO
2005-04-03 18:08   ` tmoran

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