[GRASS-user] The tomcat shut down when encounter some error grass commond

Glynn Clements glynn at gclements.plus.com
Sun Sep 20 08:18:58 EDT 2009


maven apache wrote:

> In my application ,I provide a interface which can called by users to
> execute some geo process through the web,for example,user send a map,and a
> width to the server ,then the server can do a buffer operation using the
> grass(the server make the grass commond) according to the parameter from
> client  .
> But I found that if user give a invalide parameter, then the grass commond
> maybe error, I can get the error message in the log, but my web server
> (tomcat)shut down itself.
> Any one have encountered the same suitation?

The GRASS libraries typically handle errors by terminating the calling
process via exit(). This eliminates the need for the caller to handle
errors; either the function succeeds or the process is terminated.

This approach is perfectly adequate for the intended use of the GRASS
libraries, i.e. short-lived, non-interactive commands.

OTOH, it's quite unsuitable for persistent processes, as any error
will terminate the process. But persistent processes aren't the
intended use of the GRASS libraries, and that isn't going to change.

The problems with persistent processes aren't limited to error
handling either. Many static variables are initialised upon first use
and cannot be changed thereafter.

If you want to use GRASS from within a web application, either run
GRASS commands or fork() a new child process for each request.

Finally, although you can override the fatal error handler with
G_set_error_routine(), the supplied handler mustn't return, and you
cannot safely use any GRASS functions once a fatal error has been
detected, as the data structures used by the libraries will be in an
undefined state.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list