1. ALEXANDER TAPIA
  2. PowerBuilder
  3. Wednesday, 2 August 2023 02:43 AM UTC

Our PB windows application was developed in PB version 8 and it has been migrated to PB 2019 R3. The PB 8 build it not crashing but when it was migrated to PB2019 R3, we encountered crashing issue during its runtime. I did a debugging and found out that the application is crashing inside the window function, of_filter( ). By the way, the back end is Oracle 12g.


Here is the code under the window object, function of_filter:

/////////////////////////////////////////////////////////////////////////////
// Object      	:   w_job_list
// Function  	:   of_filter
//
//  Override:     No
//
// Arguments:		None
//						
// Returns  :     (None)
//
// Description:   Filters the job list data window to match what the user
//                has selected as a filter option.
//
// ///////////////////////////////////////////////////////////////////////////

String  ls_filter
integer li_rc
Long 	 ll_primary_rowcount, ll_filter_rowcount
Long    ll_row
long    ll_rows
long    ll_found
decimal ld_job_id
string  ls_sort
string  ls_server_date_time
long		ll_job_search

dw_list.SetRedraw( FALSE )
iuo_parent.SetRedraw( FALSE)
ib_filter_in_progress = true
IF iuo_parent.dw_job_search.Rowcount() > 0 THEN
	ld_job_id = iuo_parent.dw_job_search.object.job_id[iuo_parent.dw_job_search.Getrow()]
End If

/* rbl 4 April 2023   VSDEV-744
 * For some reason, this Filter action doesnt work with an empty primary buffer,
 * nor do subsequent filters if I skip over this one.
 * Move all rows from the Filter buffer to the Primary buffer before filtering. */
/* rbl 23 June 2023   VSDEV-801
 * Now it sometimes doesn't work at all, but sometimes it does.
 * Move all rows from filtered to primary regardless of counts. */
ll_primary_rowcount = iuo_parent.dw_job_search.RowCount()
ll_filter_rowcount = iuo_parent.dw_job_search.FilteredCount()

li_rc = iuo_parent.dw_job_search.RowsMove &
					(1, ll_filter_rowcount, Filter!, &
					 iuo_parent.dw_job_search, 1, Primary!)
//IF ((ll_primary_rowcount = 0) AND (ll_filter_rowcount > 0)) THEN
//END IF

iuo_parent.dw_job_search.SetFilter( '' )
iuo_parent.dw_job_search.Filter()
ll_rows = iuo_parent.dw_job_search.RowCount()


CHOOSE CASE as_status
	CASE 'W'
		ls_server_date_time = string(sqlca.of_get_server_datetime(),"YYYY-MM-DD")
		
		ls_sort = 'Long(bill_customer_no) A, enter_date A, prefix_sort A'
		ls_filter = "( isnull(ship_date) and status not in ( 'CANCEL' , 'STKCANCL') ) "+&
		            "or (date(ship_date) = "+ls_server_date_time+") "+&
						"or (status in ( 'CANCEL', 'STKCANCL' ) "+&
						     " and date(cancel_date) = "+ls_server_date_time+")"
		dw_list.Object.date_holder_t.text = 'Ship Date'
		FOR ll_row = 1 TO ll_rows
			dw_list.Object.date_holder[ll_row] = iuo_parent.dw_job_search.Object.ship_date[ll_row]
		NEXT					 
					 
	CASE 'S'
		ls_sort = 'Long(bill_customer_no) A, ship_date A, prefix_sort A'
		dw_list.Object.date_holder_t.text = 'Ship Date'
		FOR ll_row = 1 TO ll_rows
			dw_list.Object.date_holder[ll_row] = iuo_parent.dw_job_search.Object.ship_date[ll_row]
		NEXT
		ls_filter = 'Not IsNull( ship_date )'
		
	CASE 'C'
		ls_sort = 'Long(bill_customer_no) A, cancel_date A, prefix_sort A'
		dw_list.Object.date_holder_t.text = 'Cancel Date'
		FOR ll_row = 1 TO ll_rows
			dw_list.Object.date_holder[ll_row] = iuo_parent.dw_job_search.Object.cancel_date[ll_row]
		NEXT
		ls_filter = 'Not IsNull( cancel_date )'
		
	CASE 'A'
		ls_sort = 'Long(bill_customer_no) A, enter_date A, prefix_sort A'
		ls_filter = ''
		dw_list.Object.date_holder_t.text = 'Ship Date'
		FOR ll_row = 1 TO ll_rows
			dw_list.Object.date_holder[ll_row] = iuo_parent.dw_job_search.Object.ship_date[ll_row]
		NEXT					 

END CHOOSE

li_rc = iuo_parent.dw_job_search.SetFilter( ls_filter )
If IsNull(li_rc) or li_rc < 1 Then
     error.of_application_error(this,"of_filter",&
	     "Error encountered when setting filter.~r~n"+&
		  "   Return code = "+f_null_check(li_rc)+"~r~n"+&
		  "   Filter command = "+f_null_check(ls_filter))
End IF
	
li_rc = iuo_parent.dw_job_search.Filter()
If IsNull(li_rc) or li_rc < 1 Then
     error.of_application_error(this,"of_filter",&
	     "Error encountered when filtering job list.~r~n"+&
		  "   Return code = "+f_null_check(li_rc)+"~r~n"+&
		  "   Filter command = "+f_null_check(ls_filter))
End IF

li_rc = iuo_parent.dw_job_search.SetSort( ls_sort )
If IsNull(li_rc) or li_rc < 1 Then
     error.of_application_error(this,"of_filter",&
	     "Error encountered when setting sort criteria.~r~n"+&
		  "   Return code = "+f_null_check(li_rc)+"~r~n"+&
		  "   Sort command = "+f_null_check(ls_sort))
End IF

li_rc = iuo_parent.dw_job_search.Sort()
If IsNull(li_rc) or li_rc < 1 Then
     error.of_application_error(this,"of_filter",&
	     "Error encountered when sorting job list.~r~n"+&
		  "   Return code = "+f_null_check(li_rc)+"~r~n"+&
		  "   Sort command = "+f_null_check(ls_sort))
End IF

ib_filter_in_progress = false

//  Put the current row back to the same job id if the job id exists
//  in the current list.

ll_found = 0
IF not ISNULL(ld_job_id) and ld_job_id <> 0 THEN 
	ll_found=iuo_parent.dw_job_search.Find("job_id = " + String(ld_job_id),1,iuo_parent.dw_job_search.RowCount())
End If
If ll_found = 0 or ll_found <> iuo_parent.dw_job_search.getrow() or ll_found > 0 Then
		iuo_parent.dw_job_search.ScrollTorow(max(1,ll_found))
End If	
dw_list.SetRedraw( TRUE )
iuo_parent.SetRedraw( TRUE)

this.Event vs_set_environment()


Here is an Event Log description of the crash:

Faulting application name: customer.exe, version: 5.0.0.0, time stamp: 0x6100e416
Faulting module name: orageneric12.dll, version: 12.2.0.1, time stamp: 0x58a2624c
Exception code: 0xc0000005
Fault offset: 0x01136007
Faulting process ID: 0x4578
Faulting application start time: 0x01d9c4e68bb84a68
Faulting application path: C:\SourceTree\Build Release\V05.22.00-VSDEV819\customer\customer.exe
Faulting module path: C:\Oracle\Win.32\12.2_InstantClient\bin\orageneric12.dll
Report ID: a16e707a-0f52-40d3-8fb2-e868019a4cd3
Faulting package full name:
Faulting package-relative application ID:



Anyone else experience this?

Regards,
Alex


ALEXANDER TAPIA Accepted Answer Pending Moderation
  1. Wednesday, 9 August 2023 01:38 AM UTC
  2. PowerBuilder
  3. # 1

Hi, Good day.  I've found the line of code which is causing the application to blow up. I added a message box before the iuo_parent.dw_job_search.Filter() and when I ran the .EXE, it showed the MessageBox("VSDEV-833","Begin Filter") and didn't showed the next messagebox and the application crashed. It seems that there is an issue on the "filter" method. Any idea regarding the bug on filter method?

Appreciate any feedback(s).

MessageBox("VSDEV-833","Begin Setfilter")
iuo_parent.dw_job_search.SetFilter( '' )
MessageBox("VSDEV-833","Begin Filter")
iuo_parent.dw_job_search.Filter() //This is the line where the application blows up.
MessageBox("VSDEV-833","End Filter")
Comment
  1. ALEXANDER TAPIA
  2. Wednesday, 9 August 2023 02:24 AM UTC
Hi,



The return value of iuo_parent.dw_job_search.SetFilter( ' ' ) is 1.



iuo_parent.dw_job_search.dataobject = "d_job_search"



Regards,

Alex



  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 9 August 2023 04:14 AM UTC
So that seems to be ok. What if you do a preview of d_job_search in the IDE? How many rows does it retrieve?

Have you tried using the ORA OCI driver instead of instant client?

Just hoping to give you any ideas ....
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 9 August 2023 12:35 PM UTC
FYI: the "instant client" DD client is based on OCI.dll.
  1. Helpful
There are no comments made yet.
ALEXANDER TAPIA Accepted Answer Pending Moderation
  1. Wednesday, 2 August 2023 06:52 AM UTC
  2. PowerBuilder
  3. # 2

I've implemented a message box and re-build the application. Tested it in runtime and it runs until the MessageBox("End of RowsMove") so the next step I did is to debug the code from the ll_primary_rowcount = iuo_parent.dw_job_search.RowCount( ) down to the rowsmove line. I've found out that li_rc is returning a "-1" value but the application is not crashing during the debugging mode and it only clears the entire window which is an expected behavior. My question, why the  rowsmove from filter to primary buffer is returning a "-1" value?

IF iuo_parent.dw_job_search.Rowcount() > 0 THEN
	ld_job_id = iuo_parent.dw_job_search.object.job_id[iuo_parent.dw_job_search.Getrow()]
End If
MessageBox("iuo_parent.dw_job_search.Rowcount()","End of iuo_parent.dw_job_search.Rowcount()")
/* rbl 4 April 2023   VSDEV-744
 * For some reason, this Filter action doesnt work with an empty primary buffer,
 * nor do subsequent filters if I skip over this one.
 * Move all rows from the Filter buffer to the Primary buffer before filtering. */
/* rbl 23 June 2023   VSDEV-801
 * Now it sometimes doesn't work at all, but sometimes it does.
 * Move all rows from filtered to primary regardless of counts. */
ll_primary_rowcount = iuo_parent.dw_job_search.RowCount()
ll_filter_rowcount = iuo_parent.dw_job_search.FilteredCount()
//li_rc = iuo_parent.dw_job_search.RowsMove(1, ll_filter_rowcount, Filter!, iuo_parent.dw_job_search, 1, Primary!)
li_rc = iuo_parent.dw_job_search.RowsMove &
					(1, ll_filter_rowcount, Filter!, &
					 iuo_parent.dw_job_search, 1, Primary!)
//IF ((ll_primary_rowcount = 0) AND (ll_filter_rowcount > 0)) THEN
//END IF
MessageBox("End of RowsMove","End of RowsMove")
Comment
  1. Andreas Mykonios
  2. Wednesday, 2 August 2023 09:10 AM UTC
By the way, have you checked Miguel's answer (https://community.appeon.com/index.php/qna/q-a/powerbuilder-2019-r3-build-application-is-crashing#reply-41470)? What he says may be important

Andreas.
  1. Helpful
  1. John Fauss
  2. Friday, 4 August 2023 19:00 PM UTC
What happens if you only perform the failing RowsMove that moves the rows from the Filter buffer into the Primary buffer when ii_filter_rowcount > 0?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 9 August 2023 03:05 AM UTC
Yes, Alex's code snippet does not check that the rowcounts are > 0. If they are Zero, then I can see that a crash might happen.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 2 August 2023 05:06 AM UTC
  2. PowerBuilder
  3. # 3

Since you're getting an Oracle error in the event viewer, I'd say you have a look at "string(sqlca.of_get_server_datetime()..." since that seems to be the only database related code?

Comment
  1. ALEXANDER TAPIA
  2. Thursday, 3 August 2023 22:09 PM UTC
Yes, I'm checking on it. Thank you for pointing it out.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 2 August 2023 04:41 AM UTC
  2. PowerBuilder
  3. # 4

Hi,

"is crashing inside the window function, of_filter( )" ... but WHERE inside that function?

regards

Comment
  1. John Fauss
  2. Wednesday, 2 August 2023 04:51 AM UTC
Quite right. Have you used the debugger on this function? If it works when running in the debugger, then temporarily add MessageBox calls throughout the function (say, every 20-30 lines of code or just before and after repetitive loops. You need to be able to do some debugging steps yourself. And what does the vs_set_environment function call at the end of the script do?
  1. Helpful 2
  1. Roland Smith
  2. Wednesday, 2 August 2023 13:50 PM UTC
  1. Helpful 3
  1. ALEXANDER TAPIA
  2. Wednesday, 9 August 2023 01:42 AM UTC
Good day. I already found the exact line of code which is causing the application to crash.



Here it is:

iuo_parent.dw_job_search.Filter() //This is the line where the application blows up.
  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.