1. Jim Reese
  2. PowerBuilder
  3. Thursday, 25 February 2021 16:59 PM UTC

We have a customer running our PB 2017 app in a Citrix Environment. They experience random crashes when generating a document for preview. By adding writes into the code to a log table on their system, we have been able to determine exactly where the crash is occurring.

We have 2 logic paths for creating the document. Both are randomly aborting in the customer's environment. We are unable to cause an abort in our development environment, and we tried replicating their production environment and were unable to reproduce there either.

The first logic path will abort during a datastore retrieve, where the setredraw option is not being used. (the datastore is later transferred to a datawindow via GetFullState/SetFullState for previewing, but the abort occurs prior to that)

The second logic path will abort after a datawindow retrieve, where the setredraw has been set to false prior to the retrieve. The abort occurs on the Setredraw(true) method after the successful retrieve.

This must mean that the abort is occurring in both paths when PowerBuilder is formatting the layout of the retrieved datawindow/datastore report data. This document is a composite dataobject with a nested header report and multiple nested reports in the detail band, with autosizing turned on for the bands and the nested reports.

The termination is not dependent on the data, as the log shows the same user attempting to display the same document 3 minutes apart, using the same logic path. The first time it aborts, and the second time it displays without error.

Of the most recent customer test logging, there were 24 attempts to display a document. 13 were successful, and 11 aborted, a 45.83% error rate. This was a much higher failure rate than the previous testing, which was closer to a 5% error rate. This test included additional writes to the log table to precisely identify the line of code where the abort occurs, and we also added GarbageCollect() statements prior and subsequent to the retrieval logic where the errors occur.

Logic path 1 (no setredraw): 11 attempts, 6 success, 5 aborts

Logic path 2 (with setredraw): 13 attempts, 7 success, 6 aborts

We tried creating the pb.ini file with 

[DataStore Behavior]

UseHwnd=no

but the customer reported the application crashed on the 4th attempt to preview the document.

We have many other customers using the same application, and they have not reported the issue.

Who is viewing this page
Eduardo G. Accepted Answer Pending Moderation
  1. Tuesday, 16 April 2024 14:37 PM UTC
  2. PowerBuilder
  3. # 1
Comment
There are no comments made yet.
Jim Reese Accepted Answer Pending Moderation
  1. Thursday, 4 April 2024 15:19 PM UTC
  2. PowerBuilder
  3. # 2

So I'm back to this thread, with a new employer, similar problem. Citrix isn't involved, but we have a fairly complex window with multiple tabs, tabs on a tab, And the window is randomly crashing, either on open before the window displays, or when switching from one tab to another, which does cause re-retrieval of some of the datawindows. We haven't been able to precisely identify when the crash is occurring as I did previously, every effort to log or trace seems to prevent the crash from occurring.  We do have multiple dw retrieves, setredraw false/true on a tab as well as datawindow controls on the tab to prevent screen flicker, and some dws that have autosizing height objects.

It does seem to be data related, in that it gets reported as occurring when looking up a particular customer profile over others (more than 1 customer profile involved), and we can use a particular item in our testing which doesn't crash every time, but does crash when others don't.

The consistent thing is the event log reports the same exception code when the error occurs:

Faulting module name: ntdll.dll, version: 10.0.19041.3996
Exception code: 0xc0000374
Fault offset: 0x000e6d13 

This exception is STATUS_HEAP_CORRUPTION (A heap has been corrupted.)

I personally think it is related to the rendering of one or more of the datawindows, perhaps autosizing, but can't be certain. 

 

Comment
  1. Christopher Craft
  2. Tuesday, 16 April 2024 22:14 PM UTC
Jim,

I had issues a long time ago regarding using SetRedraw in the RetrieveStart/End events. I still have my code commentd out below.

// PB Bug (Cases 11737264/11736492) - Compute/Crash Issues

//SetRedraw(FALSE)



You also mentioned you use SetFullState - one thing that will cause a crash is if you do not set the DataObject of the DW/DS before doing the SetFullState.



Chris
  1. Helpful
  1. Jim Reese
  2. Thursday, 18 April 2024 16:18 PM UTC
Thanks Chris. In this new circumstance, we aren't using SetFullState like I was at the previous location.

We've reduced the number of SetRedraws to 1 pair of false/true at the beginning and end of the process, and removed all of the autosizeheight and slide logic, and we still encountered the crash. (We also came up with an interesting way of reducing the setredraws, which I'll share in a separate post).

While stepping through the code with the debugger, I noticed we are making multiple calls to a userobject published many years ago by Aart Onkenhout to use tooltips on objects in PB that don't natively support tooltips, like PictureButtons or CommandButtons. It uses external functions like LocalFree and LocalAlloc, and Microsoft's documentation suggests these functions could cause heap corruption in some cases and should in most cases be replaced by Heap functions such as HeapFree and HeapAlloc. Since our event log is showing Heap Corruption errors, this is our current focus.



Aart's website is no longer active, but can be accessed using the WayBack machine: https://web.archive.org/web/20240322234922/http://pbsite.milente.nl/
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 18 April 2024 16:30 PM UTC
Hi Jim;

FWIW: My STD Framework does the same thing for PowerTip Text on any Control but does *not* use any SDK calls. The feature is supported 100% by normal PowerScript code. You can see it in action using the OrderEntry Demo App: http://chrispollach.blogspot.com/2022/03/stdfc.html

As the Framework is free & open source, please feel free to adopt this technique in your Apps with my code / coding approach. HTH

Regards ... Chris
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 3 March 2021 19:09 PM UTC
  2. PowerBuilder
  3. # 3

Hi Jim;

  FWIW: In the past - when I had this type of App crashing issue - the problem was often narrowed down to the DB Client and/or its version thereof being used. Food for thought. HTH

Regards ... Chris

Comment
There are no comments made yet.
Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Friday, 26 February 2021 07:26 AM UTC
  2. PowerBuilder
  3. # 4

Hi Jim,

From your description, this might be related to the environment.

I suggest you try the method below and see if it works.

Add a pb.ini file in the directory where the EXE resides, the pb.ini file contains the below content:

[Data Window]
ACCESSIBILITY=0

[DataStore Behavior]
UseHwnd=no

 

Regards,

Ken

Comment
  1. Ken Guo @Appeon
  2. Thursday, 4 March 2021 09:22 AM UTC
Hi Jim,



I suggest that you try everything you can to build a reproducible case and submit it to Appeon Support, only in this way can our developers help you.



Regards,

Ken

  1. Helpful
  1. Jim Reese
  2. Tuesday, 9 March 2021 13:59 PM UTC
I appreciate that Ken, but that is the dilemma, we have never been able to reproduce the issue, although it occurs frequently but randomly at the client.

The only additional info I can provide at this time, which I should have done up front, is what they reported when the error occurs:



Faulting application name: Agtech.exe, version: 2020.1.1.4497, time stamp: 0x5b6318c2

Faulting module name: pbdwe170.dll, version: 17.2.0.1858, time stamp: 0x5b6319c8

Exception code: 0xc0000005

Fault offset: 0x00283956

Faulting process id: 0x27bc

Faulting application start time: 0x01d664344ba77169

Faulting application path: C:\Program Files (x86)\Openlink Agtech\Prod\Agtech\Agtech.exe

Faulting module path: C:\Program Files (x86)\Openlink Agtech\Prod\Agtech\pbdwe170.dll

Report Id: e611d412-eca2-4b3e-8ca9-4961167a17cf

Faulting package full name:

Faulting package-relative application ID:
  1. Helpful
  1. Ken Guo @Appeon
  2. Wednesday, 10 March 2021 10:40 AM UTC
Hi Jim,



It is hard for our developers to locate the root cause of the issue based on the event log.

You mentioned that other customer doesn’t encounter this issue, I suggest you try to do the following to this client machine, for example:

1. Upgrade the Windows OS.

2. Temporarily turn off some security software of the firewall.

3. Assign higher permissions to the current Windows user.

4. Use Run as administrator to launch the EXE.



Regards,

Ken
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 25 February 2021 19:49 PM UTC
  2. PowerBuilder
  3. # 5

Hi Jim,

I don't know the answer to this but i wanted to throw out different idea for you guys to consider.  Citrix is just a nightmare, and despite the promises is not the same thing as natively running on Windows desktops.  You can eliminate Citrix and have a true cloud app rather than client/server by deploying your project with PowerServer 2021.  Your app can be converted in matter of days.

Best regards,
Armeen

Comment
  1. Jim Reese
  2. Friday, 26 February 2021 17:21 PM UTC
Is 2021 available as a trial at this point?
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Friday, 26 February 2021 17:52 PM UTC
Beta version is available. I'll have one of our guys email you.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.