Webapp quits silently, what to check?

Hi Folks,
I have a webapp running ,and after an update it just silently quits with no message whatsoever after a few minutes.
what are the options to find out where it may come from ?
thanks.
pinging @Ricardo_Cruz

If it is deployed with Lifeboat, you can check the logs


If it is deployed with Xojo Cloud you might be able to see something by connecting through SSH and going through the logs folder.

sorry forgot to detail ! it’s on macos, standalone with no lifeboat.
no message in the console, or i don’t know how to find them…

edit: the only message i get when the app quits :

par défaut 14:03:30.325786+0200 Entering exit handler.
par défaut 14:03:30.325809+0200 Queueing exit procedure onto XPC queue. Any further messages sent will be discarded. activeSendTransactions=0
par défaut 14:03:30.325901+0200 Cancelling XPC connection. Any further reply handler invocations will not retry messages
par défaut 14:03:30.325953+0200 Exiting exit handler.
par défaut 14:03:30.326141+0200 XPC connection invalidated (daemon unloaded/disabled)
erreur 14:03:30.326275+0200 No error handler for XPC error:

ok i will try to save some log in the app.closed and app.unhandledexception events and see what’s coming from it. finger crossed.

I think it’s time to do a step-by-step run using the debugger…

well I used these two events in the web app class:

Function UnhandledException(error As RuntimeException) Handles UnhandledException as Boolean
  // Timestamp + error info
  Var now As DateTime = DateTime.Now
  Var msg As String = now.SQLDateTime + " | Error " + Error.ErrorNumber.ToString + ": " + Error.Message
  
  dim s() as String = error.Stack
  If s <> Nil and ubound(s)>=0 Then
    msg = msg + EndOfLine + "  " + String.FromArray(s, EndOfLine)
  End If
  
  // Print to terminal stdout
  Print(msg)
  
  // Append to error.log next to the executable
  Var logFile As FolderItem = App.ExecutableFile.Parent.Child("error.log")
  Try
    Var bs As BinaryStream = BinaryStream.Open(logFile, True)
    bs.Position = bs.Length
    bs.Write(msg + EndOfLine + EndOfLine)
    bs.Close
  Catch
    Try
      Var tos As TextOutputStream = TextOutputStream.Create(logFile)
      tos.Write(msg + EndOfLine + EndOfLine)
      tos.Close
    Catch
    End Try
  End Try
  
  ' prevent the app to quit
  Return True
  
End Function

and

Sub Closed() Handles Closed
  Var msg As String = DateTime.Now.SQLDateTime + " | App.Close called"
  
  // Trick to get a stack trace
  Try
    Raise New RuntimeException
  Catch e As RuntimeException
    Var s() As String = e.Stack
    If s.Count > 0 Then
      msg = msg + EndOfLine + "  Stack: " + String.FromArray(s, EndOfLine + "  ")
    End If
  End Try
  
  Print(msg)
  
  Var logFile As FolderItem = App.ExecutableFile.Parent.Child("error.log")
  Try
    Var bs As BinaryStream = BinaryStream.Open(logFile, True)
    bs.Position = bs.Length
    bs.Write(msg + EndOfLine + EndOfLine)
    bs.Close
  Catch
    Try
      Var tos As TextOutputStream = TextOutputStream.Create(logFile)
      tos.Write(msg + EndOfLine + EndOfLine)
      tos.Close
    Catch
    End Try
  End Try
End Sub

and this build a error.log file beside the webapp
and it helped me find a nil error in the session app.

hope this may help someone else in the future !

2 Likes