tuxera / ntfs-3g

NTFS-3G Safe Read/Write NTFS Driver
https://www.tuxera.com/company/open-source
GNU General Public License v2.0
994 stars 149 forks source link

Containers hang forever and cannot be killed #85

Open uhthomas opened 1 year ago

uhthomas commented 1 year ago

It looks like ntfs-3g will cause a container to hang indefinitely if an ntfs volume is mounted and used. The container can then not be killed. I encountered this in Kubernetes and the only way to remedy this is to reboot the whole node. Please see this minimal reproduction:

@uhthomas ➜ /workspaces/codespaces-blank $ docker run --privileged ghcr.io/uhthomas/automata/ntfs3g:809dbe17df677e1c47e571ab0129d088bb32853a sh -c 'fallocate -l 5M test.img && device=$(losetup -fP --show test.img) && mkfs.ntfs $device && mount $device /mnt && ls /mnt'
The partition start sector was not specified for /dev/loop6 and it could not be obtained automatically.  It has been set to 0.
The number of sectors per track was not specified for /dev/loop6 and it could not be obtained automatically.  It has been set to 0.
The number of heads was not specified for /dev/loop6 and it could not be obtained automatically.  It has been set to 0.
To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set.
Windows will not be able to boot from this device.
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes: 100% - Done.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
uhthomas commented 1 year ago

I want to note this does not happen with other filesystems like ext4.

@uhthomas ➜ /workspaces/codespaces-blank $ docker run --privileged ghcr.io/uhthomas/automata/ntfs3g:809dbe17df677e1c47e571ab0129d088bb32853a sh -c 'fallocate -l 5M test.img && device=$(losetup -fP --show test.img) && mkfs.ext4 $device && mount $device /mnt && ls /mnt' 
Unable to find image 'ghcr.io/uhthomas/automata/ntfs3g:809dbe17df677e1c47e571ab0129d088bb32853a' locally
809dbe17df677e1c47e571ab0129d088bb32853a: Pulling from uhthomas/automata/ntfs3g
074969632d76: Pull complete 
958dbe1d0a67: Pull complete 
3c2cba919283: Pull complete 
Digest: sha256:9233740fbc9d74f149079debeaa25a6a3693710365bafba47f0040eda9faaae9
Status: Downloaded newer image for ghcr.io/uhthomas/automata/ntfs3g:809dbe17df677e1c47e571ab0129d088bb32853a
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done                            
Creating filesystem with 5120 1k blocks and 1280 inodes

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

lost+found
@uhthomas ➜ /workspaces/codespaces-blank $ 
unsound commented 1 year ago

Hi, are you able to debug the hang, e.g. by attaching to the ntfs-3g process with gdb and show the stack trace of the process when it hangs?