cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

try... catch... around everything?

Former Member
0 Likes
1,427

We're having troubles with application crashes, some are probably due to PowerBuilder itself, many are probably due to our code having issues under certain circumstances. So I have the following questions:

1. Does anyone know if it possible to put a try... catch... around say the application open event and therefore catch all unexpected crashes? In which case we may be able to log the error and at least exit gracefully in some manner

2. Does anyone know a way of making Powerbuilder crash on command? I mean the PBVM itself? I was thinking to try a divide by zero error, but I assume this is captured by the PBVM itself and handled more gracefully than a PBVM crash. I guess I could just create a zillion datastores until Windows runs out of memory.

Thanks

View Entire Topic
Former Member
0 Likes

Hi Aron

Crashes are usually caused by something in your code, or at least the work around can be done there

I'm guessing that the problem is occurring in production and the users are not able to give you a clue as to what they are doing. Certainly the system error event traps "controlled" errors, but if the PB VM is bombing then its a different game.

What is in the event log? Do you get a memory dump? You could get SAP support to analyse the memory dump to tell you what is happening when it crashes. That might help.

Good luck

David

Former Member
0 Likes

The extra complication is that it's happening for a Citrix user and they seems to be kicked of Citrix but then the account is left hanging and an IT person has to kill it. As you guessed, the customers can't tell us where it happened or if there was an error message on the screen at the time or anything useful.

I'm kinda hoping I can at least shut down the application properly so the Citrix session isn't held at least. I'll have to check the SystemError event and see what it's doing. But first I need to get it to crash in hopefully a similar way to the customer.

Former Member
0 Likes

FWIW: Make sure that the SystemError event code is using a HALT command and not a HALT CLOSE if it determines that the application can not continue. Using the Halt command with a close could either crash or hang-up the PB application.   

Former Member
0 Likes

Just has a quick look at the code in SystemError, it doesn't feel right to me. It's calling uf_system_error on u_nvo_application which then opens a Window to show the error message. If there's been a system error then I'm not sure that's the safest thing to try since who knows what state the application is in.It then attempts to close the application normally.

I'd be very interested to know what kind of things other people do in their SystemError events?

Thanks.

Former Member
0 Likes

Hi Aron;

FWIW: Here is what my STD Integrated Framework does in the System Error ...

1) Log the error details 1st & foremost

  for example:

  • // Write diagnostics to the log
  • ii_rc =    THIS.of_get_message( 84, ls_title, ls_msg )
  • THIS.of_write_log ( ls_msg )
  • THIS.of_write_log ( "  Error Number ...... "    + String (Error.Number))
  • THIS.of_write_log ( "  Error Line .......... "    + String (Error.Line))
  • THIS.of_write_log ( "  Error Object ....... "     + Error.Object)
  • THIS.of_write_log ( "  Error Event ........ "     + Error.ObjectEvent)
  • THIS.of_write_log ( "  Error Message .... "    + Error.Text)

2) If running in "silent" mode (aka Batch, Service, Taskbar, etc application = > HALT

3) After logging & running as either an Appeon Web, Appeon Mobile or native GUI application, put out a graceful generic user message and ask them if they want to continue.

Note: Turn on silent mode here! If the MSG Box dies and the SystemError event is entered again - then the code will take the Step#2 path. 

4) MessageBox to User to continue (Yes/No)?

5) YES=> Log the user's response to #4 & exit event.

    NO =>  eMail log to support, Log that action & then HALT

HTH

Regards ... Chris

Former Member
0 Likes

I like to record system and datawindow errors in an error table in the database. Then add a window to the app where you can view the errors.

Former Member
0 Likes

We email any errors to our Support desk, This avoids asking the user what happened We are also able to proactively fix the problem or more likely report it to their IT department as it's their problem

Former Member
0 Likes

Thanks everyone, I guess this means just because you had a System Error it doesn't mean PowerBuilder itself is unstable, as you still seem to be able to do things like write to logs and send emails. So our System Error code may not be too bad.

We did have a number of timer events in our application and I suspect these were guilty of causing some of the crashes. They have, so I'm told, been cleaned up a bit, so hopefully that will help.