anatol / pacoloco

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

Fix download race condition #71

Closed cofinalsubnets closed 1 year ago

cofinalsubnets commented 1 year ago

Hi again. I was poking around the open issues and i had an idea about how to fix #30 by using the per-file mutex to force subsequent requests for a file to wait on the initial download to finish before serving the file from cache. This seems like a simpler fix than streaming partially-downloaded files, although it does mean that requests after the first will have to wait before returning any bytes. Does it seem like a workable solution?

Focshole commented 1 year ago

I'd not take this direction, as pacoloco downloading mechanism required a bit of reworking, as shown in #61 , due to error poorly propagating and some other issues. However, feel free to work on it if you prefer, this is just my opinion!

I'd not take the waiting path. It would keep clients on hang for downloading a file, which pacman would treat as a timeout and then ignore pacoloco to further download files within a downloading session! Serving partial files is not easy too AFAIK, as @Jabbermuggel shown.

cofinalsubnets commented 1 year ago

No problem, just a thought. Thanks for taking a look :slightly_smiling_face: