<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi everyone,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Recently, I've been experimenting converting 
MapServer 3.3.011 to FastCGI hoping to boost its performance. I'm using FastCGI 
2.2.8 and have the Apache set up. I have tried other FastCGI programs and they 
just worked fine. However, when I converted the mapserv.c using the code below, 
I have encountered some problems that I dont know how to solve. Using the code 
below, I can start mapserv without any problem. However, after one or two 
requests (i.e. zooming in/out, panning, etc), the mapserv terminate itself 
suddenly and I got the 'segmentation fault' error. On my gdb, it says 'program 
received SIGSEGV ... and terminated' and something related to malloc.c as well. 
It took me one whole week and still couldnt figure out why. I just wonder if 
anyone can kindly give me some directions. Thanks!!!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>int main(int argc, char *argv[]) {</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; int i,j;<BR>&nbsp;&nbsp;&nbsp; 
char buffer[1024];</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; if (FCGX_IsCGI()) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp; close(STDIN_FILENO);<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
close(STDOUT_FILENO);<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
close(STDERR_FILENO);<BR>&nbsp;&nbsp;&nbsp;&nbsp; FCGX_OpenSocket(":8999", 
100);<BR>&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; while(FCGI_Accept() &gt;= 0) 
{</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; ... &lt;the usual mapserv 
code&gt;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; 
return(0);<BR>&nbsp;&nbsp;&nbsp; } /* End main routine */</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><FONT face=Arial size=2>
<DIV>&nbsp;</DIV>
<DIV>Regards,</DIV>
<DIV><BR>Nicholas Lo<BR></DIV></FONT></BODY></HTML>