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

Ctrl-C on Windows doesn't interrupt, though it gives that appearance #5087

Open
2 tasks done
ts678 opened this issue Jan 21, 2024 · 0 comments
Open
2 tasks done

Ctrl-C on Windows doesn't interrupt, though it gives that appearance #5087

ts678 opened this issue Jan 21, 2024 · 0 comments

Comments

@ts678
Copy link
Collaborator

ts678 commented Jan 21, 2024

  • I have searched open and closed issues for duplicates.
  • I have searched the forum for related topics.

Environment info

  • Duplicati version: 2.0.7.100 Canary and earlier
  • Operating system: Windows
  • Backend: N/A

Description

Command line usage involves typing Control-C to interrupt running commands. Duplicati shows the right visual clues, returning the user to the Command Prompt, but its autoupdater design treats the initial process as a launcher for a child process that does the actual work.

The hidden process can result in various surprises depending on what it did. It might hold database open or result in some other conflict. Possible cases of such situations seen in the forum and Issues, however it seems time to put it on the record with its own technical Issue.

Linux (and similar) do well with this, as the terminal sends its SIGINT to the process group, as said in ctrl-c on linux doesn't cancel #1703. Technical details are scattered in man pages such as bash, setpgrp, tcsetpgrp. and tty_ioctl. Windows has different mechanisms.

.NET 6 and beyond provide for PosixSignalRegistration.Create Method which might allow fancy handling, but now that Duplicati tolerates hard kills better than it used to, even having Windows do the same presumed rough kill as Linux does would interrupt the hidden action.

One workaround is a set AUTOUPDATER_Duplicati_SKIP_UPDATE=true but that might interfere with other features you'd rather have on.

Steps to reproduce

  1. Run Duplicati.CommandLine.exe to do something that runs long enough to look around, and produces changes that one can notice.
  2. Press Ctrl-C
  3. Notice the ^C displayed, and Command Prompt readiness to accept another command.
  • Actual result:
    Command continued invisibly.
  • Expected result:
    Command looking killed, was.

Example below could be embellished with dbpath, logfile, etc. if desired. Watch it with Task Manager or Sysinternals Process Monitor.

C:\>"C:\Program Files\Duplicati 2\Duplicati.CommandLine.exe" backup file://C:\tmp\dest C:\tree --no-encryption
Backup started at 1/21/2024 9:22:50 AM
Checking remote backup ...
  Listing remote folder ...
  Listing remote folder ...
Scanning local files ...
  0 files need to be examined (0 bytes)
  6829 files need to be examined (0 bytes) (still counting)
^C
C:\>"C:\Program Files\Duplicati 2\Duplicati.CommandLine.exe" backup file://C:\tmp\dest C:\tree --no-encryption
Backup started at 1/21/2024 9:23:23 AM

ErrorID: DatabaseFormatError
Unable to determine database format: database is locked
database is locked

C:\>

The hidden backup process above can also be noticed because it will be writing files into its destination. Eventually it finishes its backup.

Example with Server:

C:\>"C:\Program Files\Duplicati 2\Duplicati.Server.exe"
^C
C:\>"C:\Program Files\Duplicati 2\Duplicati.Server.exe"
Another instance is running, and was notified

C:\>"C:\Program Files\Duplicati 2\Duplicati.Server.exe"
Another instance is running, and was notified

C:\>

Screenshots

Debug log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant