Forum Stats

  • 3,874,247 Users
  • 2,266,705 Discussions
  • 7,911,780 Comments

Discussions

UI Loader is Forever Spinning

Jasper Tanglib
Jasper Tanglib Member Posts: 74 Red Ribbon

Hi,

In Oracle 21.2.6, I have a button that will execute this code,

DECLARE
    v_cnt NUMBER;
    v_status NUMBER;
BEGIN
    INSERT INTO IMPORT_TBL (PROJECT_ID,STATUS,ASSESSMENT_TYPE,IMPORT_TYPE,ASSESSMENT_COMMENT)
    VALUES (:P37_PROJECT_ID,'S','Auto','BP','JP submitted') RETURNING ID INTO :P37_JOB_ID;
    
    PRIV_PKG.submit_priv(:P37_JOB_ID
                        ,:P37_PROJECT_ID
                        ,:P37_ENV
                        ,:P37_USER
                        ,:P37_PASS);
    COMMIT;

    v_cnt := 0;
-- Loop until status becomes letter 'C'
    WHILE v_cnt = 0
    LOOP
        SELECT COUNT(*)
        INTO v_status
        FROM IMPORT_TBL
        WHERE type = 'Auto'
        AND status = 'C'
        AND id = :P37_JOB_ID;


    IF v_status = 1 THEN
        INSERT INTO app_tbl (app_name, app_value) VALUES('TEST', 123);

        v_cnt := v_cnt + 1;
        apex_application.g_print_success_message := 'TEST FORCE EXIT';
        EXIT;
    END IF;
    apex_application.g_print_success_message := 'TEST FORCE EXIT1';
    END LOOP;
    apex_application.g_print_success_message := 'TEST FORCE EXIT2';
END;

The code above is what gets executed while the loading spinner on the UI side continues to spin until the code finishes.


The issue is, the loading spinner continues to spin forever even after the code has finished being executed as I checked the back-end side or database. I also know that it does not go into forever loop as these lines in the code are what should stop the loop, also proved this on SQL Commands.

        v_cnt := v_cnt + 1;
        apex_application.g_print_success_message := 'TEST FORCE EXIT';
        EXIT;


Is there any way to solve this issue either in the coding side or APEX's page designer side?

Any suggestions is appreciated,

Jazz

Answers

  • InoL
    InoL Member Posts: 10,199 Blue Diamond
    edited May 27, 2022 2:14AM

    This is probably a DA process, not a submit process.

    Did you activate the spinner with JavaScript before the process starts? You may have forgotten to remove the spinner after the process finishes. Something like (copied from the manual):

    To show the spinner when processing starts.

    var lSpinner$ = apex.util.showSpinner( $( "#container_id" ) );
    

    To remove the spinner when processing ends.

    lSpinner$.remove();
    
    


  • Jasper Tanglib
    Jasper Tanglib Member Posts: 74 Red Ribbon

    Hi @InoL, I double checked the few DAs in the page, it had its own buttons not related to my button. I also disabled them by setting their server-side condition into 'Never' just to make sure and I proceeded with rerunning my process but it still took forever.

    I also did not activate the spinner through JavaScript. The spinner that appears is the apex default that just shows up every time you submit a button.

  • fac586
    fac586 Senior Technical Architect Member Posts: 21,459 Red Diamond

    In Oracle 21.2.6, I have a button that will execute this code

    How? What is the button action? Where is the code located?

    What does PRIV_PKG.submit_priv() do?

    The code above is what gets executed while the loading spinner on the UI side continues to spin until the code finishes.

    How long does that take?

  • InoL
    InoL Member Posts: 10,199 Blue Diamond

    I also know that it does not go into forever loop as these lines in the code are what should stop the loop, also proved this on SQL Commands.

    -- Loop until status becomes letter 'C'
    

    How do you know it actually becomes 'C'? Where and how would that happen? (apart from your forced EXIT)

     AND id = :P37_JOB_ID;
    

    Does P37_JOB_ID have a value? Is it submitted before calling your procedure?

    Put debug messages in your code and debug it.

    BTW: your loop is extremely resource consuming. Put a SLEEP in the loop.

  • Jasper Tanglib
    Jasper Tanglib Member Posts: 74 Red Ribbon

    Hi @fac586,

    How? What is the button action? Where is the code located?

    - Clicking on "TEST PRIV" button will perform a Submit Page action. The process for the TEST PRIV button executes the code I posted above when clicked.

    What does PRIV_PKG.submit_priv() do?

    - I do not fully grasp the entire code of this package as it was pre made when I worked on this item, but let's just say the package triggers several lines of code for some other functionality then triggers a job at the end. I am also quite sure that this has no factor in the forever spinning loader as I made sure in my tests that all code in this package runs successfully at the back end. So even after all code successfully runs at the back end, the forever spinning loader continues.

    Its the WHILE loop in my above code that is causing the forever loader, but the loader does not stop even though I have my proper exit statements.

  • Jasper Tanglib
    Jasper Tanglib Member Posts: 74 Red Ribbon

    Hi @InoL,

    How do you know it actually becomes 'C'? Where and how would that happen? (apart from your forced EXIT)

    - Part of the code in PRIV_PKG.submit_priv package will make the update to letter 'C'.


    Does P37_JOB_ID have a value? Is it submitted before calling your procedure?

    Yes, P37_JOB_ID gets a value from the insert statement,

    INSERT INTO IMPORT_TBL (PROJECT_ID,STATUS,ASSESSMENT_TYPE,IMPORT_TYPE,ASSESSMENT_COMMENT)
        VALUES (:P37_PROJECT_ID,'S','Auto','BP','JP submitted') RETURNING ID INTO :P37_JOB_ID;
    


    Already did a lot of testing, I can really say it has nothing to do with the package. The forever loading spinner occurred when I added my WHILE LOOP, but then again, it should not load forever since I have the proper lines of code that will make it exit the code.

  • Jasper Tanglib
    Jasper Tanglib Member Posts: 74 Red Ribbon

    The WHILE LOOP I added started the forever loading spinner. The forever loading spinner should not happen as I have my proper lines of code in the loop that should make the loop stop. I also proved this by executing the entire code in SQL Commands. In SQL Commands, it successfully stops the code after about 4 minutes. Now when I execute the code using my "TEST PRIV" button, the forever loading spinner occurs. I am starting to think it is an APEX bug.