Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: CTRL+C doesn't terminate sessions on Windows #105

Open
AWS-Samuel opened this issue Sep 11, 2024 · 0 comments
Open

Bug: CTRL+C doesn't terminate sessions on Windows #105

AWS-Samuel opened this issue Sep 11, 2024 · 0 comments
Labels
bug Something isn't working needs triage A new issue that needs a first look

Comments

@AWS-Samuel
Copy link

AWS-Samuel commented Sep 11, 2024

Describe the bug

CTRL+C doesn't terminate sessions on Windows. I tested on both Linux and Windows and confirmed only Windows was affected.

Expected Behaviour

CTRL+C to terminate the session on Windows.

Current Behaviour

CTRL+C doesn't terminate session on Windows. I

Reproduction Steps

On windows, with the following template:

specificationVersion: jobtemplate-2023-09
name: Python script
steps:
  - name: Run
    script:
      actions:
        onRun:
          command: python
          args: ['{{Task.File.sleep}}']
      embeddedFiles:
      - name: sleep
        type: TEXT
        filename: sleep.py
        data: |
          import time
          for i in range(10):
              print(f"Waiting {i}", flush=True)
              time.sleep(1)
          print("Exiting script.")

Run

openjd run template.yaml --step Run and then send CTRL+C.

The program will fail to exit and only once the session is over you will see that it did attempt to cancel the session. Here are some logs:

(venvtemp) C:\tmp\venvtemp>openjd run template.yaml --step Run
Wed Sep 11 15:39:15 2024
Wed Sep 11 15:39:15 2024        ==============================================
Wed Sep 11 15:39:15 2024        --------- Running Task
Wed Sep 11 15:39:15 2024        ==============================================
Wed Sep 11 15:39:15 2024        ----------------------------------------------
Wed Sep 11 15:39:15 2024        Phase: Setup
Wed Sep 11 15:39:15 2024        ----------------------------------------------
Wed Sep 11 15:39:15 2024        Writing embedded files for Task to disk.
Wed Sep 11 15:39:15 2024        Mapping: Task.File.sleep -> C:\ProgramData\Amazon\OpenJD\sample_session4n3p_urq\embedded_files2uo2tdd_\sleep.py
Wed Sep 11 15:39:15 2024        Wrote: sleep -> C:\ProgramData\Amazon\OpenJD\sample_session4n3p_urq\embedded_files2uo2tdd_\sleep.py
Wed Sep 11 15:39:15 2024        ----------------------------------------------
Wed Sep 11 15:39:15 2024        Phase: Running action
Wed Sep 11 15:39:15 2024        ----------------------------------------------
Wed Sep 11 15:39:15 2024        Running command powershell.exe -NonInteractive -File C:\ProgramData\Amazon\OpenJD\sample_session4n3p_urq\tmpz2wddzli.ps1
Wed Sep 11 15:39:15 2024        Command started as pid: 24984
Wed Sep 11 15:39:15 2024        Output:
Wed Sep 11 15:39:17 2024        Waiting 0
Wed Sep 11 15:39:18 2024        Waiting 1
Wed Sep 11 15:39:19 2024        Waiting 2
Wed Sep 11 15:39:20 2024        Waiting 3
Wed Sep 11 15:39:21 2024        Waiting 4
Wed Sep 11 15:39:22 2024        Waiting 5
Wed Sep 11 15:39:23 2024        Waiting 6
Wed Sep 11 15:39:24 2024        Waiting 7
Wed Sep 11 15:39:25 2024        Waiting 8
Wed Sep 11 15:39:26 2024        Waiting 9
Wed Sep 11 15:39:27 2024        Exiting script.
Wed Sep 11 15:39:27 2024        Interruption signal recieved.
Wed Sep 11 15:39:27 2024        Open Job Description CLI: Cancelling the session...
Wed Sep 11 15:39:27 2024        Open Job Description CLI: Session terminated by user while running action: 'Run Step 'Run' with Task parameters '{}''.
Wed Sep 11 15:39:27 2024        Open Job Description CLI: ERROR executing action: 'Run Step 'Run' with Task parameters '{}'' (see Task logs for details)
Wed Sep 11 15:39:27 2024        Open Job Description CLI: Local Session ended! Now cleaning up Session resources.

--- Results of local session ---

Session ended with errors; see Task logs for details

Job: Python script
Step: Run
Duration: 11.469836800009944 seconds
Tasks run: 1

Environment

At minimum:

  1. Operating system: Windows
  2. Output of python3 --version: Python 3.9.13
  3. Version of your openjd-cli package (see: pip show openjd-cli): Tested with 0.4.0 and 0.4.4.

I also tried changing the version of openjd-sessions down to 0.5.0 and the behavior was the same, so I don't believe this is recently introduced.

@AWS-Samuel AWS-Samuel added bug Something isn't working needs triage A new issue that needs a first look labels Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage A new issue that needs a first look
Projects
None yet
Development

No branches or pull requests

1 participant