kiwix / kiwix-tools

Command line Kiwix tools: kiwix-serve, kiwix-manage, ...
https://download.kiwix.org/release/kiwix-tools/
GNU General Public License v3.0
434 stars 85 forks source link

kiwix-serve seg-faults when opening NFS mounted files #451

Closed abelpc closed 3 years ago

abelpc commented 3 years ago

When launching kiwix-serve with a ZIM file stored in a NFSv2 mount point (directory), kiwix-serve immediately crashes, returning a Segmentation Fault.

I tried executing it with a ZIM file stored in SSHFS/FUSE mounted directory, and kiwix-serve worked correctly.

kelson42 commented 3 years ago

Kiwix does not take care of such low level details... but should never crash. There is something wrong probably with the configuration of the NFS.

abelpc commented 3 years ago

Yes, it is probably something with the NFS server. However, a more informative error output other than "Segmentation Fault" would result in more effective workarounds to fix it.

kelson42 commented 3 years ago

@abelpc I agree, if the computer has a display, maybe you can try with one of our Kiwix browser extension. Would be interested to know if it works.

abelpc commented 3 years ago

The problem happens when kiwix-serve is executed:

kiwix-serve -d /home/test/zim_nfs/wikipedia_de_all_nopic_2021-03.zim

Right after executing it, the following error is returned:

Unable to add the ZIM file 'wikipedia_de_all_nopic_2021-03.zim' to the internal library.

However, if one executes the same command with a local file or with a file in a SSHFS/FUSE mount point, the command works correctly.

Below follows the NFS mount point configuration:

192.168.1.229:/mnt/zim_dir on /home/test/zim_nfs type nfs (rw,relatime,vers=2,rsize=8192,wsize=8192,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.229,mountvers=1,mountport=40756,mountproto=udp,local_lock=none,addr=192.168.1.229)

kelson42 commented 3 years ago

Unable to add the ZIM file 'wikipedia_de_all_nopic_2021-03.zim' to the internal library.

This happens typically when the file is not (fully) readable. What happens if in place of running kiwix-serve you just run md5sum of the file? If it goes to the end, what is the result?

abelpc commented 3 years ago

Hm.. But the file permission is set to 777. But I do see differences in the md5sum done in the server and done in the NFS client:

Client: 5a09928e66cad580fce108fe05f973b9 /home/test/zim_nfs/wikipedia_de_all_nopic_2021-03.zim Server: c082e735a6c3cd1f9d90722da6707b4f /mnt/zim_dir/wikipedia_de_all_nopic_2021-03.zim

So it is indeed the NFS server.

kelson42 commented 3 years ago

@abelpc if you are able to copy/upload the "broken" ZIM via NFS and uploaded it somewhere, I would be thankful for it and we would analyze the crash scenario. Regarding the NFS problem, I'm still interested in the root cause if you find it. NFS has a largefiles option for mount... maybe there is something to digg-in in that direction.

kelson42 commented 3 years ago

@abelpc Any new infos here?

kelson42 commented 3 years ago

No feedback. Closing.