<div>Benedikt,</div>
<div>I also have tried valgrind, electricfence and other tools like memcheck&nbsp;and other malloc checkers one year ago to detect a mysterious segfault in java mapscript, but gave up because of all the output they were generating.
</div>
<div>&nbsp;</div>
<div>I sincerely hope you will succeed, good luck!</div>
<div>&nbsp;</div>
<div>Best regards,</div>
<div>Umberto<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 11/2/05, <b class="gmail_sendername">Benedikt Rothe</b> &lt;<a href="mailto:umn-ms@hydrotec.de">umn-ms@hydrotec.de</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br><font face="sans-serif" size="2">Thanks Umberto! Good hint. In this context I found something.</font> 
<br><br><font face="sans-serif" size="2">Since this kind of problem may occure to others to, I'll briefly </font><br><font face="sans-serif" size="2">summarize the steps I go:</font> <br><br><font face="sans-serif" size="2">
a) In map.h include somewhere the line</font> <br><font face="sans-serif" size="2">#include &lt;mcheck.h&gt;</font> <br><br><font face="sans-serif" size="2">b) Compile Mapserver with debug-option:</font> <br><font face="sans-serif" size="2">
./configure &lt;flags&gt; &nbsp;--enable-debug</font> <br><font face="sans-serif" size="2">make</font> <br><br><font face="sans-serif" size="2">c) Before starting tomcat set the environmentvariable &nbsp;MALLOC_TRACE</font> <br><font face="sans-serif" size="2">
to the name of a logfile.</font> <br><font face="sans-serif" size="2">export MALLOC_TRACE=/opt/jakarta-tomcat-4.1.31/logs/malloctrace</font> <br><br><font face="sans-serif" size="2">The tracefile will contains information about calls to &quot;malloc&quot; and &quot;free&quot;:
</font> <br><font face="sans-serif" size="2">&nbsp; &nbsp;- Function called malloc/free </font><br><font face="sans-serif" size="2">&nbsp; &nbsp;- address of allocated/freed memory</font> <br><br><font face="sans-serif" size="2">By this file one can look for the &quot;pairs&quot;. 
</font><br><br><font face="sans-serif" size="2">I'll still have to test in in practice. But I'm hopefull, that this will help to </font><br><font face="sans-serif" size="2">narrow the problem down.</font> <br><br><font face="sans-serif" size="2">
Benedikt Rothe</font> <br><br><br><font size="2"><tt>Umberto Nicoletti &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:umberto.nicoletti@gmail.com" target="_blank">umberto.nicoletti@gmail.com</a>
&gt; schrieb am 02.11.2005 12:29:05: 
<div><span class="e" id="q_107518eac6c72443_1"><br><br>&gt; Newer glibc have internal checks that are probably turned on by<br>&gt; default on some distros.<br>&gt; Try to play with the MALLOC_CHECK_ variable and read this (it is about
<br>&gt; fedora core, but should apply to suse too):<br>&gt; <br>&gt; &nbsp; &nbsp; glibc<br>&gt; &nbsp; &nbsp; &nbsp; The version of glibc provided with Fedora Core 3 performs<br>&gt; &nbsp; &nbsp; &nbsp; additional internal sanity checks to prevent and detect data
<br>&gt; &nbsp; &nbsp; &nbsp; corruption as early as possible. By default, should corruption<br>&gt; &nbsp; &nbsp; &nbsp; be detected, a message similar to the following will be displayed<br>&gt; &nbsp; &nbsp; &nbsp; on standard error (or logged via syslog if stderr is not open):
<br>&gt; <br>&gt; &nbsp; &nbsp; &nbsp; *** glibc detected *** double free or corruption: 0x0937d008 ***<br>&gt; <br>&gt; &nbsp; &nbsp; &nbsp; By default, the program that generated this error will also be<br>&gt; &nbsp; &nbsp; &nbsp; killed; however, this (and whether or not an error message is
<br>&gt; &nbsp; &nbsp; &nbsp; generated) can be controlled via the MALLOC_CHECK_ environment<br>&gt; &nbsp; &nbsp; &nbsp; variable. The following settings are supported:<br>&gt; <br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0 -- Do not generate an error message, and do not kill the program
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 -- Generate an error message, but do not kill the program<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2 -- Do not generate an error message, but kill the program<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3 -- Generate an error message and kill the program
<br>&gt; <br>&gt; &nbsp; &nbsp; &nbsp; Note<br>&gt; <br>&gt; &nbsp; &nbsp; &nbsp; If MALLOC_CHECK_ is explicitly set a value other than 0, this<br>&gt; &nbsp; &nbsp; &nbsp; causes glibc to perform more tests that are more extensive than<br>&gt; &nbsp; &nbsp; &nbsp; the default, and may impact performance.
<br>&gt; <br>&gt; &nbsp; &nbsp; &nbsp; Should you have a program from a third party ISV that triggers<br>&gt; &nbsp; &nbsp; &nbsp; these corruption checks and displays a message, you should<br>&gt; &nbsp; &nbsp; &nbsp; file a defect report with the application's vendor, since this
<br>&gt; &nbsp; &nbsp; &nbsp; indicates a serious bug.<br>&gt; <br>&gt; Best regards,<br>&gt; Umberto<br>&gt; <br>&gt; On 11/2/05, Benedikt Rothe &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:umn-ms@hydrotec.de" target="_blank">
umn-ms@hydrotec.de</a>&gt; wrote:<br>&gt; &gt;<br>&gt; &gt; Dear Mapserver-Users<br>&gt; &gt;<br>&gt; &gt; We developed a Tomcat/Mapserver-Site using Mapscript on<br>&gt; &gt; Linux/SUSE 9.3.<br>&gt; &gt;<br>&gt; &gt; Many things run fine. On a test-machine we made successfully
<br>&gt; &gt; some stress-testing and Tomcat runs for weeks.<br>&gt; &gt;<br>&gt; &gt; Unfortunately Tomcat crashes on the customers production-machine<br>&gt; &gt; approximately once a day. It runs for several hours,<br>
&gt; &gt; passes stress-tests successfully but crashes unpredictable after<br>&gt; &gt; 12-20hours.<br>&gt; &gt;<br>&gt; &gt; The crash occurs in Mapserver-Code. Message in the Tomcat-log<br>&gt; &gt; is<br>&gt; &gt; *** glibc detected *** double free or corruption (top): 0x0xf99950&quot;
<br>&gt; &gt;<br>&gt; &gt; Question: Can I do something to make this error-message more helpful?<br>&gt; &gt; I'd like to have the stack and the line-numbers in the sourcecode.<br>&gt; &gt; (I mean the C-stack and C-linenumber and not the Java-Stack...)
<br>&gt; &gt;<br>&gt; &gt; I looked through the gcc-man-page, but I coudn't find anything helpful.<br>&gt; &gt;<br>&gt; &gt; Thanks<br>&gt; &gt; Benedikt Rothe<br></span></div></tt></font></blockquote></div><br>