anatol / pacoloco

Caching proxy server for Arch Linux pacman
MIT License
199 stars 30 forks source link

http_proxy and db cache issue #108

Open ykelvis opened 2 months ago

ykelvis commented 2 months ago

It seems if the proxy server is unavailable (either offline completely or due to network issue) when pacoloco is actively using it, then pacoloco will become completely unusable. Only restart can fix. And also seems pacoloco don't send locally available cache (for db files) when network is down.

Basic info:

Platform: docker Image: ghcr.io/anatol/pacoloco:latest

Steps to reproduce:

  1. Configure pacoloco to use http_proxy, http_proxy: http://192.168.0.11:8080
  2. Start a proxy server at port 8080, and start pacoloco
  3. Run pacman -Syu. Everything works fine.
  4. Kill the proxy server.
  5. Run pacman -Syu, pacman returns "failed to download".
  6. Start the proxy server again. Expect everything goes back to normal.
  7. Run pacman -Syu, but pacman still returns same network error. I also noticed that there is no requests made to the proxy server.
  8. Restart pacoloco container, everything works again.

The errors in step 7:

On pacman:

:: Synchronizing package databases...
 core.db failed to download
 extra.db failed to download
 multilib.db failed to download
 archlinuxcn.db failed to download
error: failed retrieving file 'core.db' from mirrors.local : The requested URL returned error: 404
error: failed retrieving file 'extra.db' from mirrors.local : The requested URL returned error: 404
error: failed retrieving file 'multilib.db' from mirrors.local : The requested URL returned error: 404
warning: too many errors from mirrors.local, skipping for the remainder of this transaction
error: failed retrieving file 'archlinuxcn.db' from mirrors.local : The requested URL returned error: 404
error: failed to synchronize all databases (failed to retrieve some files)

On pacoloco:

pacoloco-1  | 2024/05/14 21:27:26 unable to download file archlinux/extra/os/x86_64/extra.db
pacoloco-1  | 2024/05/14 21:27:26 unable to download file archlinux/multilib/os/x86_64/multilib.db
pacoloco-1  | 2024/05/14 21:27:26 unable to download file archlinuxcn/x86_64/archlinuxcn.db
pacoloco-1  | 2024/05/14 21:27:26 unable to download file archlinux/core/os/x86_64/core.db

Prefetch is also broken:

pacoloco-1  | 2024/05/14 21:36:00 Starting prefetching packages...
pacoloco-1  | 2024/05/14 21:36:00 An error occurred for mirror {/repo/archlinux/core/os/x86_64/core.db archlinux 2024-05-14 21:32:21.846675592 +0800 +0800} :unable to download file archlinux/core/os/x86_64/core.db
pacoloco-1  | 2024/05/14 21:36:00 An error occurred for mirror {/repo/archlinux/extra/os/x86_64/extra.db archlinux 2024-05-14 21:32:23.907249368 +0800 +0800} :unable to download file archlinux/extra/os/x86_64/extra.db
pacoloco-1  | 2024/05/14 21:36:00 An error occurred for mirror {/repo/archlinux/multilib/os/x86_64/multilib.db archlinux 2024-05-14 21:32:20.908618101 +0800 +0800} :unable to download file archlinux/multilib/os/x86_64/multilib.db
pacoloco-1  | 2024/05/14 21:36:00 An error occurred for mirror {/repo/archlinuxcn/x86_64/archlinuxcn.db archlinuxcn 2024-05-14 21:32:22.503971676 +0800 +0800} :unable to download file archlinuxcn/x86_64/archlinuxcn.db
pacoloco-1  | 2024/05/14 21:36:00 Finished prefetching packages!
pacoloco-1  | 2024/05/14 21:36:00 Finished prefetching routine!
pacoloco-1  | 2024/05/14 21:36:00 On 2024-05-14 21:38:59.999999953 +0800 CST m=+404.298213542 the prefetching routine will be run again