Uniface User Forum

 View Only
  • 1.  delete instance & open cursors

    Posted 06-09-2024 12:47

    I have found that deleting an instance of a component does not release the open cursors that were created during the instance.

    They remain and are not reused... Even though they are obsolete.

    Can anyone confirm if this is the case and if it is a bug?

    U10.04.01 / oracle



    ------------------------------
    Osman Shariff
    ------------------------------


  • 2.  RE: delete instance & open cursors

    Posted 06-10-2024 03:28
    Edited by Gianni Sandigliano 06-10-2024 03:42

    Hi Osman,

    Just my initial thought:
    cursor management is in charge to DB drivers layer(s) and I do not expect an explicit deleteinstance instruction should/would close cursors opened during its execution.
    As an example a batch job calling in a loop same component operation: should it close and reopen same cursor on each execution?
    It would become negative from performance perspective!

    Are there specific reasons you're expecting it?

    Regards,
    Gianni



    ------------------------------
    Gianni Sandigliano
    IT
    ------------------------------



  • 3.  RE: delete instance & open cursors

    Posted 06-10-2024 05:00

    Morning Gianni

    I have the situation of a frm calling a service in a loop (1000 times).

    The service does a newinstance, sql, deleteinstance

    The result is too many curors open.

    The general problem seems to be not to create a newinstance from within a loop. 

    Better to start the newinstance outside of the loop, and call the instance many times within the loop. 



    ------------------------------
    Osman Shariff
    ------------------------------



  • 4.  RE: delete instance & open cursors

    Posted 06-10-2024 08:13

    Hi Osman

    What is the SQL you are executing?
    Is a UnifAce statment like READ,WRITE,DELETE
    Or is it expecit a SQL command  SQL/data "do something" ?
    In ther later case, UnifAce does not know anything about your SQL-command.
    So it's up to you to close a pending cursor 

    And as Gianni said:
    If possible to the instantiation,destruction of a instance outside the loop :-)


    Ingo



    ------------------------------
    Ingo Stiller
    Aareon Deutschland GmbH
    ------------------------------



  • 5.  RE: delete instance & open cursors

    Posted 06-11-2024 04:27

    Hi Ingo... 

    The command is a simple retrieve/e and there is no conventional way to close open cursors in oracle. 



    ------------------------------
    Osman Shariff
    ------------------------------



  • 6.  RE: delete instance & open cursors

    Posted 06-11-2024 04:54

    I have found the reason for the problem I had :-

    So, uniface with oracle seem to handle open cursors (connections to the database) very well.  New cursors are created when needed, and deleted when not.  Cursors can also be left open and reused by all the transactions on the database.  This is all done behind the scene and us developers don't need to worry about them.

    In my case it did not work correctly...  

    In a loop

      There was a component variable (handle) call to a service(SER1) which called another service(SER2) .

      There was then a local entry variable (handle) calling the same service (SERV2).

      SERV2 is doing a retrieve/e

    The solution was to simple use the component variable (handle) in all cases and only ever have one instance of the service.

    Im not sure what exactly caused the cursors to remain open, but understanding and simplifying the code worked.

    So the conclusion is uniface tends to know what its doing with open cursors as long as its done correct.



    ------------------------------
    Osman Shariff
    ------------------------------