mamba-org / mamba

The Fast Cross-Platform Package Manager
https://mamba.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.93k stars 358 forks source link

Download of repodata is not interruptible by CTRL-C #2646

Open maxnoe opened 1 year ago

maxnoe commented 1 year ago

Troubleshooting docs

How did you install Mamba?

Mambaforge

Search tried in issue tracker

download repodata keyboard interrupt ctrl c

Latest version of Mamba

Tried in Conda?

I do not have this problem with Conda, just with Mamba

Describe your issue

The process of downloading the current repodata is not interruptible using CTRL-C, the download finishes and only then is a keyboard interrupt received and the program exits.

mamba info / micromamba info

No response

Logs

No response

environment.yml

No response

~/.condarc

No response

jonashaag commented 1 year ago

I think this is the same as https://github.com/mamba-org/mamba/issues/482 and https://github.com/mamba-org/mamba/issues/1650

Contributions welcome!

maxnoe commented 1 year ago

These are similar, but not the same. It's not in a prompt, like the other two, but during the download of repodata

jonashaag commented 1 year ago

OK, I guess the underlying issue is the same but let's keep this as a separate bug

ahrib commented 1 year ago

Ctrl-C (SIGINT) not being handled correctly during mamba update can result in a corrupted / unknown state of packages.

e.g. On Windows performing a SIGINT at the Confirm changes: [Y/n] dialogue seems to partially continue the download and all packages are marked as being updated.. It is unknown what state these packages are in.

Suggest some sort of verification is added to installation/updates to update package status only when it is confirmed they are as expected (not corrupt, and not tampered with)

jonashaag commented 1 year ago

That's concerning. Can you please let us know how to reproduce this?

ahrib commented 11 months ago

After further testing my specific test case is repeatable on Windows. I have a MacOS machine as well but cannot repeat the issue there. I have not tested Linux.

hope the below steps are clear. Let me know if you need more info.

test environment Windows 10 64 bit mamba create -n test_env python=3.10 -y

reproduction steps

  1. run conda activate test_env
  2. run python --version the result will show Python 3.10.13
  3. run mamba update -n test_env python=3.11
  4. wait until you see Confirm changes: [Y/n]
  5. Press Ctrl-C (SIGINT) once
  6. wait until you see Terminate batch job (Y/N)?
  7. type y and press enter
  8. run python --version the result will show Python 3.11.6

expected result update is aborted, new version of packages are not installed. i.e. Python to remain v 3.10

actual result some commands did not execute as a batch process was terminated (between step 5 and 6 above) .. but new version of packages appear to be installed (e.g. Python is updated to v 3.11). Unknown to end user whether everything is OK.

mamba info - windows system

        mamba version : 1.5.3
     active environment : base
    active env location : C:\Users\username\AppData\Local\mambaforge
            shell level : 1
       user config file : C:\Users\username\.condarc
 populated config files : C:\Users\username\AppData\Local\mambaforge\.condarc
          conda version : 23.10.0
    conda-build version : not installed
         python version : 3.11.6.final.0
       virtual packages : __archspec=1=x86_64
                          __win=0=0
       base environment : C:\Users\username\AppData\Local\mambaforge  (writable)
      conda av data dir : C:\Users\username\AppData\Local\mambaforge\etc\conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : C:\Users\username\AppData\Local\mambaforge\pkgs
                          C:\Users\username\.conda\pkgs
                          C:\Users\username\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\username\AppData\Local\mambaforge\envs
                          C:\Users\username\.conda\envs
                          C:\Users\username\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/23.10.0 requests/2.31.0 CPython/3.11.6 Windows/10 Windows/10.0.19045 solver/libmamba conda-libmamba-solver/23.11.1 libmambapy/1.5.3
          administrator : True
             netrc file : None
           offline mode : False