Jump to page: 1 24  
Page
Thread overview
to Walter: important BUG (I think)
Aug 19, 2004
Martin
Content-type (was: to Walter: important BUG)
Aug 19, 2004
Arcane Jill
Aug 19, 2004
Martin
Aug 19, 2004
Martin
Aug 19, 2004
Ben Hinkle
Aug 19, 2004
Martin
Aug 19, 2004
Walter
IMPORTANT: to Walter
Aug 20, 2004
Bent Rasmussen
Aug 20, 2004
Matthew
Aug 20, 2004
Juanjo Álvarez
Aug 20, 2004
kinghajj
Aug 20, 2004
anon
Aug 20, 2004
ub
Aug 20, 2004
Martin
Aug 20, 2004
Martin
Aug 20, 2004
Matthew
Aug 20, 2004
Martin
Aug 20, 2004
Matthew
Aug 20, 2004
Sean Kelly
Aug 20, 2004
pragma
Aug 20, 2004
Sean Kelly
Aug 20, 2004
antiAlias
Aug 20, 2004
Andy Friesen
Aug 20, 2004
Matthew
Aug 20, 2004
Ben Hinkle
Aug 20, 2004
Helmut Leitner
Aug 20, 2004
Daniel Horn
Aug 20, 2004
Martin
Aug 21, 2004
Martin
Aug 21, 2004
h3r3tic
Re: IMPORTANT: to Walter- WORKS
Aug 21, 2004
Martin
Aug 21, 2004
Martin
Re: IMPORTANT: to Walter-ONE MORE QUESTION
Aug 21, 2004
Martin
Aug 22, 2004
Walter
Aug 21, 2004
antiAlias
Aug 21, 2004
Martin
Aug 20, 2004
Walter
August 19, 2004
I have been writing a cgi program and I've noticed one problem. There tend to be some problems with local arrays (inside functions).

Here is a sample program, that tends to crash about 1/10 of time. It only crashes on a busy web server, never on my local computer. (And it isnt the fflush function, it's the same without it)
-----------------------------------------------------------------------
import std.c.stdlib;
import std.c.stdio;
import std.stream;
import std.string;
import std.conv;

void ulog(char []s){  //LOGS ONTO SCREEN
printf("%.*s\n",s);
fflush(std.c.stdio.stdout);
}

int open(){
char *s;
char abs[2000];
char qu[100];
int a;
ulog("reaches this only 9 times of 10!\n");
return 0;
}


int yhenda(){
char MEM[2200];
int a;
ulog("point(2.1) \n");
open();
ulog("point(2.2) \n");
return 0;
}


int main(){
printf("Content-type: text/html\n\n");
fflush(std.c.stdio.stdout);
ulog("point(1.1)\n");
yhenda();
ulog("point(1.2)\n");
return 0;
}
-----------------------------------------------------------------------
Very simple program, shouldn't crash.
(Notice: when I put char []abs=new char[2000]; instead of char abs[2000];, the
same with qu, it works fine.)


I tested it over ssh, here is the screen(viga.cgi is the name of the progam, it is compiled with the latest version of dmd):
-----------------------------------------------------------------------
bash-2.05b$ ./viga.cgi
Content-type: text/html

point(1.1)

point(2.1)

reaches this only 9 times of 10!

point(2.2)

point(1.2)

bash-2.05b$ ./viga.cgi
Content-type: text/html

point(1.1)

point(2.1)

Segmentation fault (core dumped)
bash-2.05b$ ./viga.cgi
Content-type: text/html

point(1.1)

point(2.1)

Segmentation fault (core dumped)
bash-2.05b$ ./viga.cgi
Content-type: text/html

point(1.1)

point(2.1)

reaches this only 9 times of 10!

point(2.2)

point(1.2)

bash-2.05b$ bash-2.05b$
---------------------------------------------------------------------

I can send you the core dump files. I dont want to put them on a public server, because they might contain important information about my server. Can I send them to your email?

Martin.



August 19, 2004
In article <cg1o1m$179m$1@digitaldaemon.com>, Martin says...

>printf("Content-type: text/html\n\n");

Martin, if you change this to:

>printf("Content-type: text/html; charset=UTF-8\n\n");

(and you save your source file in UTF-8), then all your problems with Latin-1
will go away. (Sorry I can't help with the bug though). Oh, and remember to use
\uXXXX instead of \xXX.

Arcane Jill



August 19, 2004
And I don't think that it is the gc problem. I turned it off, but everything was the same.

Martin

In article <cg1o1m$179m$1@digitaldaemon.com>, Martin says...
>
>I have been writing a cgi program and I've noticed one problem. There tend to be some problems with local arrays (inside functions).
>
>Here is a sample program, that tends to crash about 1/10 of time. It only crashes on a busy web server, never on my local computer. (And it isnt the fflush function, it's the same without it)
>-----------------------------------------------------------------------
>import std.c.stdlib;
>import std.c.stdio;
>import std.stream;
>import std.string;
>import std.conv;
>
>void ulog(char []s){  //LOGS ONTO SCREEN
>printf("%.*s\n",s);
>fflush(std.c.stdio.stdout);
>}
>
>int open(){
>char *s;
>char abs[2000];
>char qu[100];
>int a;
>ulog("reaches this only 9 times of 10!\n");
>return 0;
>}
>
>
>int yhenda(){
>char MEM[2200];
>int a;
>ulog("point(2.1) \n");
>open();
>ulog("point(2.2) \n");
>return 0;
>}
>
>
>int main(){
>printf("Content-type: text/html\n\n");
>fflush(std.c.stdio.stdout);
>ulog("point(1.1)\n");
>yhenda();
>ulog("point(1.2)\n");
>return 0;
>}
>-----------------------------------------------------------------------
>Very simple program, shouldn't crash.
>(Notice: when I put char []abs=new char[2000]; instead of char abs[2000];, the
>same with qu, it works fine.)
>
>
>I tested it over ssh, here is the screen(viga.cgi is the name of the progam, it is compiled with the latest version of dmd):
>-----------------------------------------------------------------------
>bash-2.05b$ ./viga.cgi
>Content-type: text/html
>
>point(1.1)
>
>point(2.1)
>
>reaches this only 9 times of 10!
>
>point(2.2)
>
>point(1.2)
>
>bash-2.05b$ ./viga.cgi
>Content-type: text/html
>
>point(1.1)
>
>point(2.1)
>
>Segmentation fault (core dumped)
>bash-2.05b$ ./viga.cgi
>Content-type: text/html
>
>point(1.1)
>
>point(2.1)
>
>Segmentation fault (core dumped)
>bash-2.05b$ ./viga.cgi
>Content-type: text/html
>
>point(1.1)
>
>point(2.1)
>
>reaches this only 9 times of 10!
>
>point(2.2)
>
>point(1.2)
>
>bash-2.05b$ bash-2.05b$
>---------------------------------------------------------------------
>
>I can send you the core dump files. I dont want to put them on a public server, because they might contain important information about my server. Can I send them to your email?
>
>Martin.
>
>
>


August 19, 2004
Walter isn't around at the moment, so can someone else comment on this topic, maybe I missed something here.


Thank you!

In article <cg1p18$1a58$1@digitaldaemon.com>, Martin says...
>
>And I don't think that it is the gc problem. I turned it off, but everything was the same.
>
>Martin
>
>In article <cg1o1m$179m$1@digitaldaemon.com>, Martin says...
>>
>>I have been writing a cgi program and I've noticed one problem. There tend to be some problems with local arrays (inside functions).
>>
>>Here is a sample program, that tends to crash about 1/10 of time. It only crashes on a busy web server, never on my local computer. (And it isnt the fflush function, it's the same without it)
>>-----------------------------------------------------------------------
>>import std.c.stdlib;
>>import std.c.stdio;
>>import std.stream;
>>import std.string;
>>import std.conv;
>>
>>void ulog(char []s){  //LOGS ONTO SCREEN
>>printf("%.*s\n",s);
>>fflush(std.c.stdio.stdout);
>>}
>>
>>int open(){
>>char *s;
>>char abs[2000];
>>char qu[100];
>>int a;
>>ulog("reaches this only 9 times of 10!\n");
>>return 0;
>>}
>>
>>
>>int yhenda(){
>>char MEM[2200];
>>int a;
>>ulog("point(2.1) \n");
>>open();
>>ulog("point(2.2) \n");
>>return 0;
>>}
>>
>>
>>int main(){
>>printf("Content-type: text/html\n\n");
>>fflush(std.c.stdio.stdout);
>>ulog("point(1.1)\n");
>>yhenda();
>>ulog("point(1.2)\n");
>>return 0;
>>}
>>-----------------------------------------------------------------------
>>Very simple program, shouldn't crash.
>>(Notice: when I put char []abs=new char[2000]; instead of char abs[2000];, the
>>same with qu, it works fine.)
>>
>>
>>I tested it over ssh, here is the screen(viga.cgi is the name of the progam, it is compiled with the latest version of dmd):
>>-----------------------------------------------------------------------
>>bash-2.05b$ ./viga.cgi
>>Content-type: text/html
>>
>>point(1.1)
>>
>>point(2.1)
>>
>>reaches this only 9 times of 10!
>>
>>point(2.2)
>>
>>point(1.2)
>>
>>bash-2.05b$ ./viga.cgi
>>Content-type: text/html
>>
>>point(1.1)
>>
>>point(2.1)
>>
>>Segmentation fault (core dumped)
>>bash-2.05b$ ./viga.cgi
>>Content-type: text/html
>>
>>point(1.1)
>>
>>point(2.1)
>>
>>Segmentation fault (core dumped)
>>bash-2.05b$ ./viga.cgi
>>Content-type: text/html
>>
>>point(1.1)
>>
>>point(2.1)
>>
>>reaches this only 9 times of 10!
>>
>>point(2.2)
>>
>>point(1.2)
>>
>>bash-2.05b$ bash-2.05b$
>>---------------------------------------------------------------------
>>
>>I can send you the core dump files. I dont want to put them on a public server, because they might contain important information about my server. Can I send them to your email?
>>
>>Martin.
>>
>>
>>
>
>


August 19, 2004
Does the server system impose a maximum stack size for cgi programs?

Martin wrote:

> I have been writing a cgi program and I've noticed one problem. There tend to be some problems with local arrays (inside functions).
> 
> Here is a sample program, that tends to crash about 1/10 of time. It only crashes on a busy web server, never on my local computer. (And it isnt the fflush function, it's the same without it)
> -----------------------------------------------------------------------
> import std.c.stdlib;
> import std.c.stdio;
> import std.stream;
> import std.string;
> import std.conv;
> 
> void ulog(char []s){  //LOGS ONTO SCREEN
> printf("%.*s\n",s);
> fflush(std.c.stdio.stdout);
> }
> 
> int open(){
> char *s;
> char abs[2000];
> char qu[100];
> int a;
> ulog("reaches this only 9 times of 10!\n");
> return 0;
> }
> 
> 
> int yhenda(){
> char MEM[2200];
> int a;
> ulog("point(2.1) \n");
> open();
> ulog("point(2.2) \n");
> return 0;
> }
> 
> 
> int main(){
> printf("Content-type: text/html\n\n");
> fflush(std.c.stdio.stdout);
> ulog("point(1.1)\n");
> yhenda();
> ulog("point(1.2)\n");
> return 0;
> }
> -----------------------------------------------------------------------
> Very simple program, shouldn't crash.
> (Notice: when I put char []abs=new char[2000]; instead of char abs[2000];,
> the same with qu, it works fine.)
> 
> 
> I tested it over ssh, here is the screen(viga.cgi is the name of the progam, it is compiled with the latest version of dmd):
> -----------------------------------------------------------------------
> bash-2.05b$ ./viga.cgi
> Content-type: text/html
> 
> point(1.1)
> 
> point(2.1)
> 
> reaches this only 9 times of 10!
> 
> point(2.2)
> 
> point(1.2)
> 
> bash-2.05b$ ./viga.cgi
> Content-type: text/html
> 
> point(1.1)
> 
> point(2.1)
> 
> Segmentation fault (core dumped)
> bash-2.05b$ ./viga.cgi
> Content-type: text/html
> 
> point(1.1)
> 
> point(2.1)
> 
> Segmentation fault (core dumped)
> bash-2.05b$ ./viga.cgi
> Content-type: text/html
> 
> point(1.1)
> 
> point(2.1)
> 
> reaches this only 9 times of 10!
> 
> point(2.2)
> 
> point(1.2)
> 
> bash-2.05b$ bash-2.05b$
> ---------------------------------------------------------------------
> 
> I can send you the core dump files. I dont want to put them on a public server, because they might contain important information about my server. Can I send them to your email?
> 
> Martin.

August 19, 2004
Well, I think it is not the case right now. The program crashes just the same if
I am running from a cgi enviroment (browser) or just like normal program (from
ssh).

But good point, thak you!

In article <cg24n5$1t0o$1@digitaldaemon.com>, Ben Hinkle says...
>
>
>Does the server system impose a maximum stack size for cgi programs?
>
>Martin wrote:
>
>> I have been writing a cgi program and I've noticed one problem. There tend to be some problems with local arrays (inside functions).
>> 
>> Here is a sample program, that tends to crash about 1/10 of time. It only crashes on a busy web server, never on my local computer. (And it isnt the fflush function, it's the same without it)
>> -----------------------------------------------------------------------
>> import std.c.stdlib;
>> import std.c.stdio;
>> import std.stream;
>> import std.string;
>> import std.conv;
>> 
>> void ulog(char []s){  //LOGS ONTO SCREEN
>> printf("%.*s\n",s);
>> fflush(std.c.stdio.stdout);
>> }
>> 
>> int open(){
>> char *s;
>> char abs[2000];
>> char qu[100];
>> int a;
>> ulog("reaches this only 9 times of 10!\n");
>> return 0;
>> }
>> 
>> 
>> int yhenda(){
>> char MEM[2200];
>> int a;
>> ulog("point(2.1) \n");
>> open();
>> ulog("point(2.2) \n");
>> return 0;
>> }
>> 
>> 
>> int main(){
>> printf("Content-type: text/html\n\n");
>> fflush(std.c.stdio.stdout);
>> ulog("point(1.1)\n");
>> yhenda();
>> ulog("point(1.2)\n");
>> return 0;
>> }
>> -----------------------------------------------------------------------
>> Very simple program, shouldn't crash.
>> (Notice: when I put char []abs=new char[2000]; instead of char abs[2000];,
>> the same with qu, it works fine.)
>> 
>> 
>> I tested it over ssh, here is the screen(viga.cgi is the name of the progam, it is compiled with the latest version of dmd):
>> -----------------------------------------------------------------------
>> bash-2.05b$ ./viga.cgi
>> Content-type: text/html
>> 
>> point(1.1)
>> 
>> point(2.1)
>> 
>> reaches this only 9 times of 10!
>> 
>> point(2.2)
>> 
>> point(1.2)
>> 
>> bash-2.05b$ ./viga.cgi
>> Content-type: text/html
>> 
>> point(1.1)
>> 
>> point(2.1)
>> 
>> Segmentation fault (core dumped)
>> bash-2.05b$ ./viga.cgi
>> Content-type: text/html
>> 
>> point(1.1)
>> 
>> point(2.1)
>> 
>> Segmentation fault (core dumped)
>> bash-2.05b$ ./viga.cgi
>> Content-type: text/html
>> 
>> point(1.1)
>> 
>> point(2.1)
>> 
>> reaches this only 9 times of 10!
>> 
>> point(2.2)
>> 
>> point(1.2)
>> 
>> bash-2.05b$ bash-2.05b$
>> ---------------------------------------------------------------------
>> 
>> I can send you the core dump files. I dont want to put them on a public server, because they might contain important information about my server. Can I send them to your email?
>> 
>> Martin.
>


August 19, 2004
This looks like it could be a problem with stack overflows.

"Martin" <Martin_member@pathlink.com> wrote in message news:cg1o1m$179m$1@digitaldaemon.com...
> I have been writing a cgi program and I've noticed one problem. There tend
to be
> some problems with local arrays (inside functions).
>
> Here is a sample program, that tends to crash about 1/10 of time. It only crashes on a busy web server, never on my local computer. (And it isnt the fflush function, it's the same without it)
> -----------------------------------------------------------------------
> import std.c.stdlib;
> import std.c.stdio;
> import std.stream;
> import std.string;
> import std.conv;
>
> void ulog(char []s){  //LOGS ONTO SCREEN
> printf("%.*s\n",s);
> fflush(std.c.stdio.stdout);
> }
>
> int open(){
> char *s;
> char abs[2000];
> char qu[100];
> int a;
> ulog("reaches this only 9 times of 10!\n");
> return 0;
> }
>
>
> int yhenda(){
> char MEM[2200];
> int a;
> ulog("point(2.1) \n");
> open();
> ulog("point(2.2) \n");
> return 0;
> }
>
>
> int main(){
> printf("Content-type: text/html\n\n");
> fflush(std.c.stdio.stdout);
> ulog("point(1.1)\n");
> yhenda();
> ulog("point(1.2)\n");
> return 0;
> }
> -----------------------------------------------------------------------
> Very simple program, shouldn't crash.
> (Notice: when I put char []abs=new char[2000]; instead of char abs[2000];,
the
> same with qu, it works fine.)
>
>
> I tested it over ssh, here is the screen(viga.cgi is the name of the
progam, it
> is compiled with the latest version of dmd):
> -----------------------------------------------------------------------
> bash-2.05b$ ./viga.cgi
> Content-type: text/html
>
> point(1.1)
>
> point(2.1)
>
> reaches this only 9 times of 10!
>
> point(2.2)
>
> point(1.2)
>
> bash-2.05b$ ./viga.cgi
> Content-type: text/html
>
> point(1.1)
>
> point(2.1)
>
> Segmentation fault (core dumped)
> bash-2.05b$ ./viga.cgi
> Content-type: text/html
>
> point(1.1)
>
> point(2.1)
>
> Segmentation fault (core dumped)
> bash-2.05b$ ./viga.cgi
> Content-type: text/html
>
> point(1.1)
>
> point(2.1)
>
> reaches this only 9 times of 10!
>
> point(2.2)
>
> point(1.2)
>
> bash-2.05b$ bash-2.05b$
> ---------------------------------------------------------------------
>
> I can send you the core dump files. I dont want to put them on a public
server,
> because they might contain important information about my server. Can I
send
> them to your email?
>
> Martin.
>
>
>


August 20, 2004
See: "to Walter: important BUG (I think)"

Error on a very low level of the D language is a very big problem and I think it must be handled very quiqkly.

>This looks like it could be a problem with stack overflows.

Yes, and it looks like it is an error in compiler. It is not a server error, because everything elese works fine. It is not a cgi error, because I tested it also direct throw ssh.  And I don't thik there is an error in my program, because it is very simple and there is nothing there that could cause a "Segmentation fault".

I dested it with 0.99, nothing changed.

SO DO YOU WANT THE CORE DUMP FILES(I think they include the memory image of the
prgogram, at the moment of segmentation fault)?
If you do, where do I send them?
if you don't, tell me, I stop offering then.

I think this error is a very big problem, because the 1.00 version is very near.

If the 1.00 has this error, it is quite USELESS, atleast for server applications. I would have no other choice than to move back to C, because I am writing server applications and they need to work.

I am sorry for my boldness but I am just VERY WORRIED.
I was under the impression that you didn't take it very seriously.
But this error shlould be taken care of, or else the D is not very valuable.

So are you going to fix it?

And agin: do you want the core dump files?


THANK YOU!


AGAIN THE PROGRAM:


import std.c.stdlib;
import std.c.stdio;
import std.stream;
import std.string;
import std.conv;

void ulog(char []s){  //LOGS ONTO SCREEN
printf("%.*s\n",s);
fflush(std.c.stdio.stdout);
}

int open(){
char *s;
char abs[2000];
char qu[100];
int a;
ulog("reaches this only 9 times of 10!\n");
return 0;
}


int yhenda(){
char MEM[2200];
int a;
ulog("point(2.1) \n");
open();
ulog("point(2.2) \n");
return 0;
}


int main(){
printf("Content-type: text/html\n\n");
fflush(std.c.stdio.stdout);
ulog("point(1.1)\n");
yhenda();
ulog("point(1.2)\n");
return 0;
}



In article <cg2r0o$28pk$1@digitaldaemon.com>, Walter says...
>
>This looks like it could be a problem with stack overflows.
>
>"Martin" <Martin_member@pathlink.com> wrote in message news:cg1o1m$179m$1@digitaldaemon.com...
>> I have been writing a cgi program and I've noticed one problem. There tend
>to be
>> some problems with local arrays (inside functions).
>>
>> Here is a sample program, that tends to crash about 1/10 of time. It only crashes on a busy web server, never on my local computer. (And it isnt the fflush function, it's the same without it)
>> -----------------------------------------------------------------------
>> import std.c.stdlib;
>> import std.c.stdio;
>> import std.stream;
>> import std.string;
>> import std.conv;
>>
>> void ulog(char []s){  //LOGS ONTO SCREEN
>> printf("%.*s\n",s);
>> fflush(std.c.stdio.stdout);
>> }
>>
>> int open(){
>> char *s;
>> char abs[2000];
>> char qu[100];
>> int a;
>> ulog("reaches this only 9 times of 10!\n");
>> return 0;
>> }
>>
>>
>> int yhenda(){
>> char MEM[2200];
>> int a;
>> ulog("point(2.1) \n");
>> open();
>> ulog("point(2.2) \n");
>> return 0;
>> }
>>
>>
>> int main(){
>> printf("Content-type: text/html\n\n");
>> fflush(std.c.stdio.stdout);
>> ulog("point(1.1)\n");
>> yhenda();
>> ulog("point(1.2)\n");
>> return 0;
>> }
>> -----------------------------------------------------------------------
>> Very simple program, shouldn't crash.
>> (Notice: when I put char []abs=new char[2000]; instead of char abs[2000];,
>the
>> same with qu, it works fine.)
>>
>>
>> I tested it over ssh, here is the screen(viga.cgi is the name of the
>progam, it
>> is compiled with the latest version of dmd):
>> -----------------------------------------------------------------------
>> bash-2.05b$ ./viga.cgi
>> Content-type: text/html
>>
>> point(1.1)
>>
>> point(2.1)
>>
>> reaches this only 9 times of 10!
>>
>> point(2.2)
>>
>> point(1.2)
>>
>> bash-2.05b$ ./viga.cgi
>> Content-type: text/html
>>
>> point(1.1)
>>
>> point(2.1)
>>
>> Segmentation fault (core dumped)
>> bash-2.05b$ ./viga.cgi
>> Content-type: text/html
>>
>> point(1.1)
>>
>> point(2.1)
>>
>> Segmentation fault (core dumped)
>> bash-2.05b$ ./viga.cgi
>> Content-type: text/html
>>
>> point(1.1)
>>
>> point(2.1)
>>
>> reaches this only 9 times of 10!
>>
>> point(2.2)
>>
>> point(1.2)
>>
>> bash-2.05b$ bash-2.05b$
>> ---------------------------------------------------------------------
>>
>> I can send you the core dump files. I dont want to put them on a public
>server,
>> because they might contain important information about my server. Can I
>send
>> them to your email?
>>
>> Martin.
>>
>>
>>
>
>


August 20, 2004
> I think this error is a very big problem, because the 1.00 version is very near.

Oh boy, don't go down that road. :-) I believe it is possible and probable that 0.100 will follow.


August 20, 2004
That is weird... your code doesn't do anything except declare variables and a few printf()s... why doesn't it work? I agree, this needs to be fixed

In article <cg4cd0$26l$1@digitaldaemon.com>, very worried says...
>
>See: "to Walter: important BUG (I think)"
>
>Error on a very low level of the D language is a very big problem and I think it must be handled very quiqkly.
>
>>This looks like it could be a problem with stack overflows.
>
>Yes, and it looks like it is an error in compiler. It is not a server error, because everything elese works fine. It is not a cgi error, because I tested it also direct throw ssh.  And I don't thik there is an error in my program, because it is very simple and there is nothing there that could cause a "Segmentation fault".
>
>I dested it with 0.99, nothing changed.
>
>SO DO YOU WANT THE CORE DUMP FILES(I think they include the memory image of the
>prgogram, at the moment of segmentation fault)?
>If you do, where do I send them?
>if you don't, tell me, I stop offering then.
>
>I think this error is a very big problem, because the 1.00 version is very near.
>
>If the 1.00 has this error, it is quite USELESS, atleast for server applications. I would have no other choice than to move back to C, because I am writing server applications and they need to work.
>
>I am sorry for my boldness but I am just VERY WORRIED.
>I was under the impression that you didn't take it very seriously.
>But this error shlould be taken care of, or else the D is not very valuable.
>
>So are you going to fix it?
>
>And agin: do you want the core dump files?
>
>
>THANK YOU!
>
>
>AGAIN THE PROGRAM:
>
>
>import std.c.stdlib;
>import std.c.stdio;
>import std.stream;
>import std.string;
>import std.conv;
>
>void ulog(char []s){  //LOGS ONTO SCREEN
>printf("%.*s\n",s);
>fflush(std.c.stdio.stdout);
>}
>
>int open(){
>char *s;
>char abs[2000];
>char qu[100];
>int a;
>ulog("reaches this only 9 times of 10!\n");
>return 0;
>}
>
>
>int yhenda(){
>char MEM[2200];
>int a;
>ulog("point(2.1) \n");
>open();
>ulog("point(2.2) \n");
>return 0;
>}
>
>
>int main(){
>printf("Content-type: text/html\n\n");
>fflush(std.c.stdio.stdout);
>ulog("point(1.1)\n");
>yhenda();
>ulog("point(1.2)\n");
>return 0;
>}
>
>
>
>In article <cg2r0o$28pk$1@digitaldaemon.com>, Walter says...
>>
>>This looks like it could be a problem with stack overflows.
>>
>>"Martin" <Martin_member@pathlink.com> wrote in message news:cg1o1m$179m$1@digitaldaemon.com...
>>> I have been writing a cgi program and I've noticed one problem. There tend
>>to be
>>> some problems with local arrays (inside functions).
>>>
>>> Here is a sample program, that tends to crash about 1/10 of time. It only crashes on a busy web server, never on my local computer. (And it isnt the fflush function, it's the same without it)
>>> -----------------------------------------------------------------------
>>> import std.c.stdlib;
>>> import std.c.stdio;
>>> import std.stream;
>>> import std.string;
>>> import std.conv;
>>>
>>> void ulog(char []s){  //LOGS ONTO SCREEN
>>> printf("%.*s\n",s);
>>> fflush(std.c.stdio.stdout);
>>> }
>>>
>>> int open(){
>>> char *s;
>>> char abs[2000];
>>> char qu[100];
>>> int a;
>>> ulog("reaches this only 9 times of 10!\n");
>>> return 0;
>>> }
>>>
>>>
>>> int yhenda(){
>>> char MEM[2200];
>>> int a;
>>> ulog("point(2.1) \n");
>>> open();
>>> ulog("point(2.2) \n");
>>> return 0;
>>> }
>>>
>>>
>>> int main(){
>>> printf("Content-type: text/html\n\n");
>>> fflush(std.c.stdio.stdout);
>>> ulog("point(1.1)\n");
>>> yhenda();
>>> ulog("point(1.2)\n");
>>> return 0;
>>> }
>>> -----------------------------------------------------------------------
>>> Very simple program, shouldn't crash.
>>> (Notice: when I put char []abs=new char[2000]; instead of char abs[2000];,
>>the
>>> same with qu, it works fine.)
>>>
>>>
>>> I tested it over ssh, here is the screen(viga.cgi is the name of the
>>progam, it
>>> is compiled with the latest version of dmd):
>>> -----------------------------------------------------------------------
>>> bash-2.05b$ ./viga.cgi
>>> Content-type: text/html
>>>
>>> point(1.1)
>>>
>>> point(2.1)
>>>
>>> reaches this only 9 times of 10!
>>>
>>> point(2.2)
>>>
>>> point(1.2)
>>>
>>> bash-2.05b$ ./viga.cgi
>>> Content-type: text/html
>>>
>>> point(1.1)
>>>
>>> point(2.1)
>>>
>>> Segmentation fault (core dumped)
>>> bash-2.05b$ ./viga.cgi
>>> Content-type: text/html
>>>
>>> point(1.1)
>>>
>>> point(2.1)
>>>
>>> Segmentation fault (core dumped)
>>> bash-2.05b$ ./viga.cgi
>>> Content-type: text/html
>>>
>>> point(1.1)
>>>
>>> point(2.1)
>>>
>>> reaches this only 9 times of 10!
>>>
>>> point(2.2)
>>>
>>> point(1.2)
>>>
>>> bash-2.05b$ bash-2.05b$
>>> ---------------------------------------------------------------------
>>>
>>> I can send you the core dump files. I dont want to put them on a public
>>server,
>>> because they might contain important information about my server. Can I
>>send
>>> them to your email?
>>>
>>> Martin.
>>>
>>>
>>>
>>
>>
>
>


« First   ‹ Prev
1 2 3 4