nroi / flexo

a central pacman cache
MIT License
172 stars 10 forks source link

IO Error using Linux 5.16.12 and ZFS 2.1.2 #88

Closed cuberoot74088 closed 2 years ago

cuberoot74088 commented 2 years ago

Hi @nroi,

I noticed, that flexo (v1.6.5) is not working given this configuration on Arch Linux:

$ uname -a
Linux 5.16.12-arch1-1 #1 SMP PREEMPT Wed, 02 Mar 2022 12:22:51 +0000 x86_64 GNU/Linux

$ zfs version
zfs-2.1.2-1
zfs-kmod-2.1.2-1

I obtain this error message

Mär 13 17:39:09 flexo[139047]: [2022-03-13T16:39:09.589Z INFO flexo] Primary mirror: "https://mirror.moson.org/arch/" Mär 13 17:41:44 flexo[139047]: [2022-03-13T16:41:44.008Z WARN flexo] Error while sending payload: Os { code: 22, kind: InvalidInput, message: "Invalid argument" } Mär 13 17:41:44 flexo[139047]: [2022-03-13T16:41:44.008Z ERROR flexo] Unable to serve request "": IoError(InvalidInput) Mär 13 17:41:44 flexo[139047]: [2022-03-13T16:41:44.008Z ERROR flexo] Input/Output Error: InvalidInput Mär 13 17:41:44 flexo[139047]: [2022-03-13T16:41:44.008Z WARN flexo] Closing TCP socket due to error: IoError(InvalidInput) Mär 13 17:41:48 flexo[139047]: [2022-03-13T16:41:48.407Z WARN flexo] Error while sending payload: Os { code: 22, kind: InvalidInput, message: "Invalid argument"

I can still use flexo with

Linux  5.15.13-arch1-1
zfs-2.1.2-1
zfs-kmod-2.1.2-1

I am pretty sure it is related to IO related to ZFS in 5.16, because I could run flexo on a system where it wrote to ext4 fs. Moving it to a system with storage on zfs the above error shows up.

I am happy to provide more logs or so, if you tell me what and how ;-).

Thank you very much for creating flexo and your help!

nroi commented 2 years ago

Hi @cuberoot74088, thanks for reporting this.

I've installed zfs and tried to reproduce this, but I wasn't able to. This is my config:

$ uname -a
Linux archWS 5.16.14-arch1-1 #1 SMP PREEMPT Fri, 11 Mar 2022 17:40:36 +0000 x86_64 GNU/Linux

$ zfs version
zfs-2.1.3-1
zfs-kmod-2.1.3-1

However, something that surprised me when I read your logs is the following:

Unable to serve request "": 

Notice the empty string "": This looks like the request does not include an actual file name. I was able to get the same error message by running curl against flexo and requesting an empty path, like this:

curl -v 'http://localhost:7878' > /dev/null

Apparently, there's some input validation lacking, because Flexo should return a 400 in such cases. But instead, it translates the empty request to the path /var/cache/flexo/pkg/ (or whatever your cache_directory is) and then assumes that the request can be served from cache, because the path already exists on the file system. This obviously does not work, so it runs into IO-errors.

However, I'm surprised how you ran into this error. Requests sent by pacman should always include a filename (afaik). Is this issue reproducible for you? Can you give me a pacman command or whatever command you executed that resulted in this error?

cuberoot74088 commented 2 years ago

Hi @nroi, thank you very much for your rapid response. I have now also upgraded to

Linux  5.16.14-arch1-1 #1 SMP PREEMPT Fri, 11 Mar 2022 17:40:36 +0000 x86_64 GNU/Linux

zfs-2.1.3-1
zfs-kmod-2.1.3-1

and can confirm that it is working. :+1:

So, I guess we can close it then. Thank you very much for testing it on your side as well.