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

Sören Gebbert soerengebbert at gmx.de
Tue Sep 22 16:59:28 EDT 2009


Hi,

Am Sunday 20 September 2009 14:18:58 schrieb Glynn Clements:
> 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.


Well, thats exactly the problem that i face with grass trying to run several
operations within on process using the vtkGRASSBridge.
Is there any chance to implement a conterpart to G_init() like G_uninit()
to compute several tasks in one process (not multithreaded).

Is there really no way to reset the static variables to initial state?

Best regards
Soeren



More information about the grass-user mailing list