B4J Question Auto-restart a JServer Application when app crashes

Discussion in 'B4J Questions' started by luc-dev, Jun 7, 2019.

  1. luc-dev

    luc-dev Member Licensed User

    Hi,

    Just wondering how to automatically handle a JServer App crash :

    AFAIK B4J Web applications use Jetty as an embedded http server and run in their own process.
    In case of application crash all clients are disconnected and unable to use the server.
    (a simple error in a sql statement not protected by Try/Catch block can easely crash your server)

    On the opposite, script based language (PHP,...) running with an external Web Server will not crash the server in case of error in the script.

    To secure a B4J WebServer application, is it possible to use a kind of "WatchDog" to monitor the app is running and to restart it in case of failure?

    Thanks ! :)
     
  2. MarkusR

    MarkusR Well-Known Member Licensed User

    i think every error pass here, then u can return false etc and the process will stay alive.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    That's incorrect. The server process will not end when there is an unhandled crash.

    Are you running jServer in a UI app?
     
  4. luc-dev

    luc-dev Member Licensed User

    Hi,

    I am running a console app.

    I did some more testing on another computer in debug and release mode with two "web" modules, one to test an access violation error or a SQL error and the other with just normal running code.

    The second module continues to work even after the first module is called and crashes.

    Sorry for my wrong thinking about how the embedded WebServer handles exceptions.

    It is a very good point for B4J as it enables to build web apps that need high availability.

    As a side though, is it possible to have the errors sent to the server log file?

    Thanks
     
  5. Cableguy

    Cableguy Expert Licensed User

    This is a good question, specially if we think about ABMATERIAL webapps, that also rely on jetty, and can be quite complex.
    So I'm following this with interest
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    You should start a new thread for a new question.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice