on ‎2016 Apr 20 1:31 PM
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
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
Hi Aron;
FWIW: Here is what my STD Integrated Framework does in the System Error ...
1) Log the error details 1st & foremost
for example:
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
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.
Typically you get a GPF when the call stack explodes because of too much recursion depth, like:
public subroutine of_gpf ()
of_GPF()
end subroutine
Sure... that is bad PowerBuilder Code. But you never know, when it blows up.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you call a Windows API function that has a string argument that is by ref and you fail to initialize the string to a size large enough to hold the result then you will get an abort.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aron;
Q1: try... catch... around say the application open event
A1: That would only catch an error in the processing chain of the Open event. Once the Open event is completed, the Try..Catch would be out-of-scope.
Do you have proper code in the SystemError event of the Application object class to intercept & log any errors?
Q2: Does anyone know a way of making PowerBuilder crash on command?
A2: Try the undocumented GPF ( ) method.
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Isn't there any top level code in PowerBuilder that is in scope for the whole running of an application? Boy, I've been doing too much C# recently, starting to forget everything about PowerBuilder!
I know we have something in the SystemError event, I shall have to have a look at it. It was written by someone else many, many years ago.
Q: Isn't there any top level code in PowerBuilder that is in scope for the whole running of an application?
A: No, not in a visible GUI application where the processing is dependent on an Event driven model. The only entity in control in this case would be the PBVM itself. In a Batch application where your basically in a tight processing loop - then you could wrap the Loop in a Try..Catch as typically coming out of this loop the batch application closes.
Speaking of the PBVM though ... have you tried running your PB application EXE using the internal tracing option? FYI: Invoke the executable file using the /pbdebug command-line switch, for example: EXEFILE /pbdebug
The trace file might tell you at the time of the crash at least what was processing and where within your application and/or PBVM when the non-recoverable issue happened.
Food for thought.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.