- 
                            
                                 Olan Knight Olan Knight
- PowerBuilder
- Thursday, 30 July 2020 05:00 PM UTC
UPDATE:   31-JUL-2020
   I want to thank Chris, John, and Mike for their suggestions!
   Using most of Jon's suggestions, I added a YIELD() and a GarbageCollect() into the FOR loop - and the next run did not get locked up. After making a few more changes, I'll try the run again and if it does not get locked up I will mark this thread as RESOLVED.
Olan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PB2019R2
Windows 10, 64 bit platform
Oracle 12C
32 bit code, running both from the IDE and as an EXE
Summary:
I have a retrieval inside a FOR loop, and at random times it just locks up; i.e. the RETRIEVE call is made but it never completes.
Q: What could be causing the lock and how can I fix it?
Details:
The code flows like this:
Datastore   lds_aur
sqlca.autocommit = TRUE
FOR ll_aur = 1 to ll_max
   ll_rc = lds_aur.Reset
   sqlca.of_disconnect ()                 // Added as a way to maybe resolve the locks: to no avail
   sqlca.of_connect()                      //  " 
   lds_aur.dataobject = "whatever" 
   lds_aur.SetTransObject (sqlca) 
   ll_count = lds_aur.Retrieve(ls_parm)    // This is the call that locks up and never completes
  <do work...>
  
   ll_rc = lds_aur.Update (TRUE, TRUE) 
   
   COMMIT;
NEXT
sqlca.autocommit = FALSE
The DBA has checked the database: there are no other users, no locks, no blocking session, and no queries in process.
Setting AutoCommit to TRUE helped significantly; the locks started occuring every few hundred rows rather than every few dozen rows.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.
