<br><br>
<div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">maven apache</b> <span dir="ltr">&lt;<a href="mailto:apachemaven0@gmail.com">apachemaven0@gmail.com</a>&gt;</span><br>
Date: 2009/9/20<br>Subject: Re: [GRASS-user] The tomcat shut down when encounter some error grass commond<br>To: Glynn Clements &lt;<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>&gt;<br><br><br>
<div><br>Thanks for your reply!</div>
<div>I am not exactly sure your meaning.</div>
<div>What is short-lived process and what is persisitent process&gt;?</div>
<div>Did you mean that if a process takes long time,then a error can terminate this thread? and the web server is in the same thread,so it is shut down?</div>
<div>If so ,does it mean that I should open a new thread for each grass commond?</div>
<div><br> </div>
<div class="gmail_quote">2009/9/20 Glynn Clements <span dir="ltr">&lt;<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>&gt;</span> 
<div>
<div></div>
<div class="h5"><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div><br>maven apache wrote:<br><br>&gt; In my application ,I provide a interface which can called by users to<br>&gt; execute some geo process through the web,for example,user send a map,and a<br>&gt; width to the server ,then the server can do a buffer operation using the<br>
&gt; grass(the server make the grass commond) according to the parameter from<br>&gt; client  .<br>&gt; But I found that if user give a invalide parameter, then the grass commond<br>&gt; maybe error, I can get the error message in the log, but my web server<br>
&gt; (tomcat)shut down itself.<br>&gt; Any one have encountered the same suitation?<br><br></div>The GRASS libraries typically handle errors by terminating the calling<br>process via exit(). This eliminates the need for the caller to handle<br>
errors; either the function succeeds or the process is terminated.<br><br>This approach is perfectly adequate for the intended use of the GRASS<br>libraries, i.e. short-lived, non-interactive commands.<br><br>OTOH, it&#39;s quite unsuitable for persistent processes, as any error<br>
will terminate the process. But persistent processes aren&#39;t the<br>intended use of the GRASS libraries, and that isn&#39;t going to change.<br><br>The problems with persistent processes aren&#39;t limited to error<br>
handling either. Many static variables are initialised upon first use<br>and cannot be changed thereafter.<br><br>If you want to use GRASS from within a web application, either run<br>GRASS commands or fork() a new child process for each request.<br>
<br>Finally, although you can override the fatal error handler with<br>G_set_error_routine(), the supplied handler mustn&#39;t return, and you<br>cannot safely use any GRASS functions once a fatal error has been<br>detected, as the data structures used by the libraries will be in an<br>
undefined state.<br><font color="#888888"><br></font></blockquote>
<div> </div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote"><font color="#888888">--<br>Glynn Clements &lt;<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>&gt;<br>
</font></blockquote></div></div></div><br></div><br>