www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - to Walter: important BUG (I think)

reply Martin <Martin_member pathlink.com> writes:
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.
Aug 19 2004
next sibling parent Arcane Jill <Arcane_member pathlink.com> writes:
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
Aug 19 2004
prev sibling next sibling parent reply Martin <Martin_member pathlink.com> writes:
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.

Aug 19 2004
parent Martin <Martin_member pathlink.com> writes:
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.


Aug 19 2004
prev sibling next sibling parent reply Ben Hinkle <bhinkle4 juno.com> writes:
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.

Aug 19 2004
parent Martin <Martin_member pathlink.com> writes:
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.


Aug 19 2004
prev sibling next sibling parent reply "Walter" <newshound digitalmars.com> writes:
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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.

Aug 19 2004
parent reply Martin (very worried) <Martin_member pathlink.com> writes:
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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.


Aug 20 2004
next sibling parent reply "Bent Rasmussen" <exo bent-rasmussen.info> writes:
 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.
Aug 20 2004
parent reply "Matthew" <admin.hat stlsoft.dot.org> writes:
I can't wait for version 0.101, so that this can be dropped for good. <sigh>

"Bent Rasmussen" <exo bent-rasmussen.info> wrote in message
news:cg4epi$3fo$1 digitaldaemon.com...
 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.

Aug 20 2004
parent Juanjo =?ISO-8859-15?Q?=C1lvarez?= <juanjuxNO SPAMyahoo.es> writes:
It'll happend again in 0.999 <g>

Matthew wrote:

 I can't wait for version 0.101, so that this can be dropped for good.
 <sigh>
 
 "Bent Rasmussen" <exo bent-rasmussen.info> wrote in message
 news:cg4epi$3fo$1 digitaldaemon.com...
 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.


Aug 20 2004
prev sibling next sibling parent kinghajj <kinghajj_member pathlink.com> writes:
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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.



Aug 20 2004
prev sibling next sibling parent reply anon <anon_member pathlink.com> writes:
I compiled the code and it works fine for me...

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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.



Aug 20 2004
next sibling parent reply ub <ub_member pathlink.com> writes:
May be it's time to run memtest86 overnight?

ub

In article <cg4fmo$3qe$1 digitaldaemon.com>, anon says...
I compiled the code and it works fine for me...

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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.




Aug 20 2004
parent Martin <Martin_member pathlink.com> writes:
Everything else works fine on this server, it is a busy web server hosting many
virtual servers.
I am renting a virtual server there.
So, I don't think it is the server.



In article <cg4gtb$4ai$1 digitaldaemon.com>, ub says...
May be it's time to run memtest86 overnight?

ub

In article <cg4fmo$3qe$1 digitaldaemon.com>, anon says...
I compiled the code and it works fine for me...

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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.





Aug 20 2004
prev sibling parent reply Martin <Martin_member pathlink.com> writes:
Did you run it in your home computer?
In my home computer it works fine too, but it crashes on a server.
It crashes avarage about 1/10 of time, can vary from 1/3 to 1/25.

In your home computer only a very few programs run, but in a server  there are
many programs. If you start the program the second time in your computer, it
will probably get the same memory addresses and the same junk that was there
last time the program run. In server, the program gets different memory each
time (ok, not each time,but often) and this memory has some junk from some other
program. So, if a program code takes memory and starts using it, without
cleaning it, it may crash depending on the junk that is in the memory.

So in your home computer, this part of the program gets 'clean' memory, and the
mistake does'nt come out, but on a server it might get 'dirty' memory, and it
crashes.

Martin


In article <cg4fmo$3qe$1 digitaldaemon.com>, anon says...
I compiled the code and it works fine for me...

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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.




Aug 20 2004
parent reply "Matthew" <admin.hat stlsoft.dot.org> writes:
It's *FAR* more likely that the server has multiple processes, and your running
it there is precipitating a genuine race
condition that is not picked up on a uniprocessor box due to atomic integer
operations.

"Martin" <Martin_member pathlink.com> wrote in message
news:cg4iog$54u$1 digitaldaemon.com...
 Did you run it in your home computer?
 In my home computer it works fine too, but it crashes on a server.
 It crashes avarage about 1/10 of time, can vary from 1/3 to 1/25.

 In your home computer only a very few programs run, but in a server  there are
 many programs. If you start the program the second time in your computer, it
 will probably get the same memory addresses and the same junk that was there
 last time the program run. In server, the program gets different memory each
 time (ok, not each time,but often) and this memory has some junk from some
other
 program. So, if a program code takes memory and starts using it, without
 cleaning it, it may crash depending on the junk that is in the memory.

 So in your home computer, this part of the program gets 'clean' memory, and the
 mistake does'nt come out, but on a server it might get 'dirty' memory, and it
 crashes.

 Martin


 In article <cg4fmo$3qe$1 digitaldaemon.com>, anon says...
I compiled the code and it works fine for me...

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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.





Aug 20 2004
parent reply Martin <Martin_member pathlink.com> writes:
In English please!

Explain it to me please!

In article <cg4jdi$5d7$1 digitaldaemon.com>, Matthew says...
It's *FAR* more likely that the server has multiple processes, and your running
it there is precipitating a genuine race
condition that is not picked up on a uniprocessor box due to atomic integer
operations.

"Martin" <Martin_member pathlink.com> wrote in message
news:cg4iog$54u$1 digitaldaemon.com...
 Did you run it in your home computer?
 In my home computer it works fine too, but it crashes on a server.
 It crashes avarage about 1/10 of time, can vary from 1/3 to 1/25.

 In your home computer only a very few programs run, but in a server  there are
 many programs. If you start the program the second time in your computer, it
 will probably get the same memory addresses and the same junk that was there
 last time the program run. In server, the program gets different memory each
 time (ok, not each time,but often) and this memory has some junk from some
other
 program. So, if a program code takes memory and starts using it, without
 cleaning it, it may crash depending on the junk that is in the memory.

 So in your home computer, this part of the program gets 'clean' memory, and the
 mistake does'nt come out, but on a server it might get 'dirty' memory, and it
 crashes.

 Martin


 In article <cg4fmo$3qe$1 digitaldaemon.com>, anon says...
I compiled the code and it works fine for me...

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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.






Aug 20 2004
parent reply "Matthew" <admin.hat stlsoft.dot.org> writes:
I suspect the process that you've built contains somewhere within it - maybe
your code, maybe the D libs - a race
condition that relates to an integer operation - say increment of a 16 or
32-bit quantity (assuming a 32-bit
architecture). On machines with only one processor such operations will
*always* work atomically, because of the way
Intel (and most other architectures) works.

However, when doing so on a machine with two processes, explicit instructions
are required to lock the bus to prevent
interleaving of the separate thread's actions. This can work as follows:

    Thread A reads the value from memory (to register)
    Thread B reads the value from memory (to register)
    Thread B increments the value (in register)
    Thread B writes the value to memory (from register)
    Thread A increments the value (in register)
    Thread A writes the value to memory (from register)

When Thread A writes the value it overwrites the changes made by thread B.
Rather than the variable being incremented
twice, as expected, the net result is only one incremented.

This is a classic race condition, and such things easily bring down processes
(or even machines!).


Note: I'm not saying that the problem that has manifested itself on your server
*is* due to this, just that it smells a
lot like it to me.


-- 
Matthew Wilson

Author: "Imperfect C++", Addison-Wesley, 2004
    (http://www.imperfectcplusplus.com)
Contributing editor, C/C++ Users Journal
    (http://www.synesis.com.au/articles.html#columns)
Director, Synesis Software
    (www.synesis.com.au)
STLSoft moderator
    (http://www.stlsoft.org)

"Youth ages, Immaturity is outgrown, Ignorance can be educated, drunkeness
sobered. But stupid lasts forever",
Aristophenes

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


"Martin" <Martin_member pathlink.com> wrote in message
news:cg4k2g$5j0$1 digitaldaemon.com...
 In English please!

 Explain it to me please!

 In article <cg4jdi$5d7$1 digitaldaemon.com>, Matthew says...
It's *FAR* more likely that the server has multiple processes, and your running
it there is precipitating a genuine


condition that is not picked up on a uniprocessor box due to atomic integer
operations.

"Martin" <Martin_member pathlink.com> wrote in message
news:cg4iog$54u$1 digitaldaemon.com...
 Did you run it in your home computer?
 In my home computer it works fine too, but it crashes on a server.
 It crashes avarage about 1/10 of time, can vary from 1/3 to 1/25.

 In your home computer only a very few programs run, but in a server  there are
 many programs. If you start the program the second time in your computer, it
 will probably get the same memory addresses and the same junk that was there
 last time the program run. In server, the program gets different memory each
 time (ok, not each time,but often) and this memory has some junk from some
other
 program. So, if a program code takes memory and starts using it, without
 cleaning it, it may crash depending on the junk that is in the memory.

 So in your home computer, this part of the program gets 'clean' memory, and the
 mistake does'nt come out, but on a server it might get 'dirty' memory, and it
 crashes.

 Martin


 In article <cg4fmo$3qe$1 digitaldaemon.com>, anon says...
I compiled the code and it works fine for me...

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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.







Aug 20 2004
parent reply Sean Kelly <sean f4.ca> writes:
In article <cg4lgq$6ac$1 digitaldaemon.com>, Matthew says...
I suspect the process that you've built contains somewhere within it - maybe
your code, maybe the D libs - a race
condition that relates to an integer operation - say increment of a 16 or
32-bit quantity (assuming a 32-bit
architecture). On machines with only one processor such operations will
*always* work atomically, because of the way
Intel (and most other architectures) works.

However, when doing so on a machine with two processes, explicit instructions
are required to lock the bus to prevent
interleaving of the separate thread's actions. This can work as follows:

    Thread A reads the value from memory (to register)
    Thread B reads the value from memory (to register)
    Thread B increments the value (in register)
    Thread B writes the value to memory (from register)
    Thread A increments the value (in register)
    Thread A writes the value to memory (from register)

When Thread A writes the value it overwrites the changes made by thread B.
Rather than the variable being incremented
twice, as expected, the net result is only one incremented.

This is a classic race condition, and such things easily bring down processes
(or even machines!).

Not to mention the possibility of CPU cache synchronization. Win32 provides the handy Interlocked calls to take care of this type of thing, but beyond that you need to use the "lock" prefix on asm code. Speaking of which, it would be nice to have native D versions of the Win32 Interlocked calls--at least increment, decrement, and compare-exchange. Sean
Aug 20 2004
next sibling parent reply pragma <EricAnderton at yahoo dot com> <pragma_member pathlink.com> writes:
In article <cg5ii9$l8e$1 digitaldaemon.com>, Sean Kelly says...

to have native D versions of the Win32 Interlocked calls--at least increment,
decrement, and compare-exchange.


Sean

Here here. Actually, since they imply such a fine-grain level of control, wouldn't these be better off as D intrinsic functions instead? Just a thought, - Pragma
Aug 20 2004
parent reply Sean Kelly <sean f4.ca> writes:
In article <cg5j1m$ljm$1 digitaldaemon.com>, pragma <EricAnderton at yahoo dot
com> says...
In article <cg5ii9$l8e$1 digitaldaemon.com>, Sean Kelly says...

to have native D versions of the Win32 Interlocked calls--at least increment,
decrement, and compare-exchange.

Here here. Actually, since they imply such a fine-grain level of control, wouldn't these be better off as D intrinsic functions instead?

Be fine with me :) It would be nice to have access to this sort of thing without pulling in any library code. Sean
Aug 20 2004
parent reply "antiAlias" <fu bar.com> writes:
While we're on that topic, what about adding rol() and ror() intrinsics
also?


"Sean Kelly" <sean f4.ca> wrote in message
news:cg5mf8$nhj$1 digitaldaemon.com...
 In article <cg5j1m$ljm$1 digitaldaemon.com>, pragma <EricAnderton at yahoo

 com> says...
In article <cg5ii9$l8e$1 digitaldaemon.com>, Sean Kelly says...

to have native D versions of the Win32 Interlocked calls--at least



decrement, and compare-exchange.

Here here. Actually, since they imply such a fine-grain level of control, wouldn't


better off as D intrinsic functions instead?

Be fine with me :) It would be nice to have access to this sort of thing without pulling in any library code. Sean

Aug 20 2004
parent Andy Friesen <andy ikagames.com> writes:
antiAlias wrote:
 While we're on that topic, what about adding rol() and ror() intrinsics
 also?

I don't know about DMD, but if memory serves, MSVC can optimize something like this into a single instruction: inline void rol(int& x, int count) { x = (x >> sizeof(int) - count) | (x << count); } -- andy
Aug 20 2004
prev sibling parent "Matthew" <admin.hat stlsoft.dot.org> writes:
"Sean Kelly" <sean f4.ca> wrote in message
news:cg5ii9$l8e$1 digitaldaemon.com...
 In article <cg4lgq$6ac$1 digitaldaemon.com>, Matthew says...
I suspect the process that you've built contains somewhere within it - maybe
your code, maybe the D libs - a race
condition that relates to an integer operation - say increment of a 16 or
32-bit quantity (assuming a 32-bit
architecture). On machines with only one processor such operations will
*always* work atomically, because of the way
Intel (and most other architectures) works.

However, when doing so on a machine with two processes, explicit instructions
are required to lock the bus to prevent
interleaving of the separate thread's actions. This can work as follows:

    Thread A reads the value from memory (to register)
    Thread B reads the value from memory (to register)
    Thread B increments the value (in register)
    Thread B writes the value to memory (from register)
    Thread A increments the value (in register)
    Thread A writes the value to memory (from register)

When Thread A writes the value it overwrites the changes made by thread B.
Rather than the variable being incremented
twice, as expected, the net result is only one incremented.

This is a classic race condition, and such things easily bring down processes
(or even machines!).

Not to mention the possibility of CPU cache synchronization. Win32 provides the handy Interlocked calls to take care of this type of thing, but beyond that you need to use the "lock" prefix on asm code. Speaking of which, it would be nice to have native D versions of the Win32 Interlocked calls--at least increment, decrement, and compare-exchange.

Ah, yes, my funky brother. At last there are 2. I tried a lot last year to get Walter interest in D providing some of these kinds of things as part of the language, and I've just started another campaign. I hope you can add weight (and better brains than mine) to the issue. :) [FYI: I'm normally a big fan of the C++-way, i.e. functionality should be provided by libraries rather than language extensions. But I think many threading constructs would be better suited in the language for D. We still have a blank sheet, and many architectures behave very similarly these days with such things as atomic integer ops, so I reckon this is an exceptional case.]
Aug 20 2004
prev sibling next sibling parent Ben Hinkle <bhinkle4 juno.com> writes:
Have you tried some simple variations like
 int main() { char[8000] x; return 0; }
or
 void foo() { char[8000] x; }
 int main(){ foo(); return 0; }
etc

Or maybe the compiler is messing up the C-style decls
char abs[2000];
vs
char[2000] abs;
That would be very wierd, but who knows...

Martin (very worried) wrote:

 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

 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];,

 same with qu, it works fine.)


 I tested it over ssh, here is the screen(viga.cgi is the name of the

 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

 because they might contain important information about my server. Can I

 them to your email?

 Martin.



Aug 20 2004
prev sibling parent reply Helmut Leitner <helmut.leitner wikiservice.at> writes:
"Martin (very worried)" wrote:
 
 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.

Martin, you are surely not ignored and there are at least a dozen people here that take this error seriously. I just found the time to compile and test your code under Suse Linux 9.1 and gcc 3.3.3, dmd 0.98. I did 1225551 runs total without a single fault. You seem to be sure it is a compiler fault. I'm not so sure about the cause of this error. Maybe its your system or gcc. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Aug 20 2004
next sibling parent reply Daniel Horn <hellcatv hotmail.com> writes:
try running it in valgrind?

Helmut Leitner wrote:
 
 "Martin (very worried)" wrote:
 
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.

Martin, you are surely not ignored and there are at least a dozen people here that take this error seriously. I just found the time to compile and test your code under Suse Linux 9.1 and gcc 3.3.3, dmd 0.98. I did 1225551 runs total without a single fault. You seem to be sure it is a compiler fault. I'm not so sure about the cause of this error. Maybe its your system or gcc.

Aug 20 2004
next sibling parent Martin <Martin_member pathlink.com> writes:
Good idea! I try it.

In article <cg5jtj$lmm$2 digitaldaemon.com>, Daniel Horn says...
try running it in valgrind?

Helmut Leitner wrote:
 
 "Martin (very worried)" wrote:
 
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.

Martin, you are surely not ignored and there are at least a dozen people here that take this error seriously. I just found the time to compile and test your code under Suse Linux 9.1 and gcc 3.3.3, dmd 0.98. I did 1225551 runs total without a single fault. You seem to be sure it is a compiler fault. I'm not so sure about the cause of this error. Maybe its your system or gcc.


Aug 20 2004
prev sibling parent reply Martin <Martin_member pathlink.com> writes:
I works perfectly in valgrind.
I tried 200 runs in valgrind, 0 errors.
I tried 200 runs without valgrind, got 14 crahses.

What do I do?




In article <cg5jtj$lmm$2 digitaldaemon.com>, Daniel Horn says...
try running it in valgrind?

Helmut Leitner wrote:
 
 "Martin (very worried)" wrote:
 
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.

Martin, you are surely not ignored and there are at least a dozen people here that take this error seriously. I just found the time to compile and test your code under Suse Linux 9.1 and gcc 3.3.3, dmd 0.98. I did 1225551 runs total without a single fault. You seem to be sure it is a compiler fault. I'm not so sure about the cause of this error. Maybe its your system or gcc.


Aug 21 2004
parent reply h3r3tic <h3r3tic dev.null> writes:
Martin wrote:
 I works perfectly in valgrind.
 I tried 200 runs in valgrind, 0 errors.
 I tried 200 runs without valgrind, got 14 crahses.
 
 What do I do?

Have you tried DMD 0.100 ?
Aug 21 2004
parent reply Martin <Martin_member pathlink.com> writes:
NOW INT FORKS FINE. thank you Walter, thank you all!

For a second, I was afraid, that I need to move back to C.
(Ok, there are always ways to workaround bugs, but when my program has to work
correctly atleast 99.9998% of times that it's executed, then I am glad, that
this bug is fixed)

My job is to write a cgi web application and it was my personal choice to use D
for it. So you know why i was so nervous.

Ok, now I will continue with my project my deadline is coming very fast.
D is a very good language for writing web (a lot better than PHP, or Java, or
even better than C).
So I reccomend it for that use.
(Hopefully there are no more big bugs, but even when there are, hope they can be
fixed. I have even seen some bugs in GNU C, so nothing is perfect)


In article <cg7g0h$1uu6$1 digitaldaemon.com>, h3r3tic says...
Martin wrote:
 I works perfectly in valgrind.
 I tried 200 runs in valgrind, 0 errors.
 I tried 200 runs without valgrind, got 14 crahses.
 
 What do I do?

Have you tried DMD 0.100 ?

Aug 21 2004
next sibling parent Martin <Martin_member pathlink.com> writes:
Sorry, spelling mistake, what I ment was:
NOW IT FORKS FINE. thank you Walter, thank you all!

In article <cg8brq$2d3n$1 digitaldaemon.com>, Martin says...
NOW INT FORKS FINE. thank you Walter, thank you all!

For a second, I was afraid, that I need to move back to C.
(Ok, there are always ways to workaround bugs, but when my program has to work
correctly atleast 99.9998% of times that it's executed, then I am glad, that
this bug is fixed)

My job is to write a cgi web application and it was my personal choice to use D
for it. So you know why i was so nervous.

Ok, now I will continue with my project my deadline is coming very fast.
D is a very good language for writing web (a lot better than PHP, or Java, or
even better than C).
So I reccomend it for that use.
(Hopefully there are no more big bugs, but even when there are, hope they can be
fixed. I have even seen some bugs in GNU C, so nothing is perfect)


In article <cg7g0h$1uu6$1 digitaldaemon.com>, h3r3tic says...
Martin wrote:
 I works perfectly in valgrind.
 I tried 200 runs in valgrind, 0 errors.
 I tried 200 runs without valgrind, got 14 crahses.
 
 What do I do?

Have you tried DMD 0.100 ?


Aug 21 2004
prev sibling next sibling parent reply Martin <Martin_member pathlink.com> writes:
What caused the error, what did you change?
I mean, is the error really gone or is it just masked,
because the error was quite clever, it only came out only on some cases on some
computers. (And doing some not so big changes in this code made the error go
away)

I am asking because I want to know if I shlould relax or do more testing?


In article <cg8brq$2d3n$1 digitaldaemon.com>, Martin says...
NOW INT FORKS FINE. thank you Walter, thank you all!

For a second, I was afraid, that I need to move back to C.
(Ok, there are always ways to workaround bugs, but when my program has to work
correctly atleast 99.9998% of times that it's executed, then I am glad, that
this bug is fixed)

My job is to write a cgi web application and it was my personal choice to use D
for it. So you know why i was so nervous.

Ok, now I will continue with my project my deadline is coming very fast.
D is a very good language for writing web (a lot better than PHP, or Java, or
even better than C).
So I reccomend it for that use.
(Hopefully there are no more big bugs, but even when there are, hope they can be
fixed. I have even seen some bugs in GNU C, so nothing is perfect)


In article <cg7g0h$1uu6$1 digitaldaemon.com>, h3r3tic says...
Martin wrote:
 I works perfectly in valgrind.
 I tried 200 runs in valgrind, 0 errors.
 I tried 200 runs without valgrind, got 14 crahses.
 
 What do I do?

Have you tried DMD 0.100 ?


Aug 21 2004
parent "Walter" <newshound digitalmars.com> writes:
"Martin" <Martin_member pathlink.com> wrote in message
news:cg8ckl$2dj0$1 digitaldaemon.com...
 What caused the error, what did you change?
 I mean, is the error really gone or is it just masked,
 because the error was quite clever, it only came out only on some cases on

 computers. (And doing some not so big changes in this code made the error

 away)

 I am asking because I want to know if I shlould relax or do more testing?

See the last post from me in this thread: 8/20/2004 at 2:58 PM
Aug 21 2004
prev sibling parent "antiAlias" <fu bar.com> writes:
<shameless plug>
Depending on what you're doing, you might find the Mango Tree could help out
rather a lot. It has an HTTP server, a Java-style servlet engine, an HTTP
client, Uri, Cookies, clustering, blah blah blah.
</shameless plug>

Nice to see D being used in what appears to be a commercial setting;
although I imagine that might raise a few eyebrows at this point, being
pre-release and all ... good for you!

<g>


"Martin" <Martin_member pathlink.com> wrote in message
news:cg8brq$2d3n$1 digitaldaemon.com...
 NOW INT FORKS FINE. thank you Walter, thank you all!

 For a second, I was afraid, that I need to move back to C.
 (Ok, there are always ways to workaround bugs, but when my program has to

 correctly atleast 99.9998% of times that it's executed, then I am glad,

 this bug is fixed)

 My job is to write a cgi web application and it was my personal choice to

 for it. So you know why i was so nervous.

 Ok, now I will continue with my project my deadline is coming very fast.
 D is a very good language for writing web (a lot better than PHP, or Java,

 even better than C).
 So I reccomend it for that use.
 (Hopefully there are no more big bugs, but even when there are, hope they

 fixed. I have even seen some bugs in GNU C, so nothing is perfect)


 In article <cg7g0h$1uu6$1 digitaldaemon.com>, h3r3tic says...
Martin wrote:
 I works perfectly in valgrind.
 I tried 200 runs in valgrind, 0 errors.
 I tried 200 runs without valgrind, got 14 crahses.

 What do I do?

Have you tried DMD 0.100 ?


Aug 21 2004
prev sibling parent Martin <Martin_member pathlink.com> writes:
Ok, I have the core dump files of the program that crashed, how do I analyze
them?

Thank you!


In article <41263AA7.57392D4E wikiservice.at>, Helmut Leitner says...
"Martin (very worried)" wrote:
 
 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.

Martin, you are surely not ignored and there are at least a dozen people here that take this error seriously. I just found the time to compile and test your code under Suse Linux 9.1 and gcc 3.3.3, dmd 0.98. I did 1225551 runs total without a single fault. You seem to be sure it is a compiler fault. I'm not so sure about the cause of this error. Maybe its your system or gcc. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com

Aug 21 2004
prev sibling parent "Walter" <newshound digitalmars.com> writes:
This is a most peculiar bug. I was able to duplicate it on my linux box,
about once out of 30 runs or so. But there's *nothing wrong* with the code
generated by the compiler. It'll also do it under gdb. It appears to happen
when the ENTER instruction is reached.

Now, I know that stack is allocated on a page-by-page basis, and if the
stack overflows there's some logic in the kernel somewhere to catch an
overflow and allocate more pages to the stack, then restart the instruction.
My experiments with gcc show it never generates an ENTER instruction to set
up the stack frame, but dmd does.

Furthermore, if you compile with -O, dmd will not generate an ENTER
instruction, and I cannot get the program to generate a fault.

Therefore, I have a sneaky suspicion there is a bug in the linux kernel
where it cannot restart an ENTER instruction after a stack overflow.

What I will do is fix dmd to never generate the ENTER under linux. In the
meantime, try compiling your program with -O and see if it works or not.
Aug 20 2004