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

division by zero in manage.py delete-disconnected-fs-submissions #7201

Open
cfm opened this issue Jul 11, 2024 · 0 comments
Open

division by zero in manage.py delete-disconnected-fs-submissions #7201

cfm opened this issue Jul 11, 2024 · 0 comments
Labels

Comments

@cfm
Copy link
Member

cfm commented Jul 11, 2024

Description

On iteration $i$ through the for-loop in securedrop.management.submissions.delete_disconnected_fs_submissions(), bytes_deleted = 0 can cause rate to be set to 0 in—

rate = bytes_deleted / time_elapsed

—leading to a ZeroDivisionError in the next iteration $i + 1$ in:

eta = filesize / rate

Steps to Reproduce

  1. Delete something in /var/lib/securedrop/store
  2. manage.py delete-disconnected-fs-submissions --force

Expected Behavior

Disconnected submissions are deleted.

Actual Behavior

Securely removing file 1/16299 /var/lib/securedrop/store/3ASULFX2WGAMVUXRYL6V2LNP77DA34TUKV4ARDHIU5OUJZQXJKVGL6VLAPGA2BJRGFFZ477RUKJBDIIQGVBGNIGKRGNCZLTIHMKCXCY=/4-stuffed_branch-reply.gpg...
elapsed: 0.06s rate: 0.0 MB/s overall rate: 0.0 MB/s
Traceback (most recent call last):
  File "/var/www/securedrop/manage.py", line 452, in <module>
    _run_from_commandline()
  File "/var/www/securedrop/manage.py", line 442, in _run_from_commandline
    rc = args.func(args)
  File "/var/www/securedrop/management/submissions.py", line 153, in delete_disconnected_fs_submissions
    eta = filesize / rate
ZeroDivisionError: float division by zero
@cfm cfm added the bug label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant