Pausing script execution with `sleep` crashes connection window

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.46.4
    • Component/s: None
    • Environment:
      OS: macOS 15.5 (24F74)
      Compass: version 1.46.4 (1.46.4)
      mongosh: version 2.5.1
    • None
    • None
    • Developer Tools

      Problem Statement/Rationale

      When pausing script execution with `sleep` crashes connection window. The Compass window becomes blank and doesn't respond anymore. See screenshot attached. It can only be closed. Compass as a whole is still responsive and a new connection window can be opened.

      The Compass log files don't show any entry after the entry which logs the code being pasted into the Compass mongosh window for execution.{}{}

      Steps to Reproduce

       

      1. Open Compass, create a new connection, connect to a replica set, click on the "MongoDB shell" icon to open a new tab with mongosh connected to the replica set.
      2. Paste the following code into mongosh:
        ```
        function testSleep() { print("Waiting 2 seconds..."); sleep(2000); print("Done"); }

        testSleep();
        ```

      3. The shell halts execution forever and never prints `Done`.
      4. Press Ctrl+C to abort the script.
      5. Paste the following code into mongosh:
        ```
        async function testSleep() { print("Waiting 2 seconds..."); awaitsleep(2000); print("Done"); }

        testSleep();

      1. The shell halts execution forever and never prints `Done`.
      2. Press Ctrl+C to abort the script.
      3. Pause the following code into mongosh:
        ```
        async function testSleep() { print("Waiting 2 seconds..."); awaitnewPromise(resolve=>setTimeout(resolve, 2000)); print("Done"); }

        testSleep();

      ```

      1. The Compass connection window turns blank and doesn't respond anymore.

      Expected Results

      In all script cases described above, script execution should be paused for 2 seconds and then continue, printing "Done".

      Actual Results

      Script execution fails as described above.

      Additional Notes

      In all script cases described above, when using mongosh in a macOS terminal window, the script executes correctly and execution is paused by 2 seconds. Hence, the same behavior is expected in a Compass mongosh window.

            Assignee:
            Unassigned
            Reporter:
            Manuel Trezza
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: