mergerfs icon indicating copy to clipboard operation
mergerfs copied to clipboard

Android smb clients issue on remove files.

Open serj-47 opened this issue 1 year ago • 10 comments

My mergerfs pool consists of two disks and is used to share both disks over the network using the samba protocol, the pool is mounted as follows:

/srv/ST32000641AS:/srv/WD20SPZX /srv/pool mergerfs cache.files=off,dropcacheonclose=true,category.create=epff,fsname=mergerfs,ignorepponrename=true,minfreespace=10G 0 0

smb.conf:

...
[Storage]
path=/srv/pool/Storage
browseable=yes
writeable=yes
only guest=yes
create mask=0777
directory mask=0777
public=yes

So, samba clients with Windows OS or Linux OS can easily access the pool using the samba protocol, and can create, move and delete files and there are no problems. But there are some problems with smb clients on Android. Here is a list of file managers for android that I have tried: -Total Commander, (you need to install a separate plugin to work with smb). -Material Files In both file managers can create and move files on the samba server, but when trying to delete an error occurs about the inability to delete a directory or file. *There is no such problem when sharing a shared directory on a disk without mergerfs.

serj-47 avatar May 20 '24 13:05 serj-47

Please provide the requested info as defined in the ticket you filled out and in the support section of the page.

trapexit avatar May 20 '24 14:05 trapexit

i Have the same issue using mergerfs as OMV 7 plugin When i delete a file on android (total comander or File manager) using SMB share i get the error : The Samba 'panic action' script, /usr/share/samba/panic-action, was called for PID 6018 ().

This means there was a problem with the program, such as a segfault. However, the executable could not be found for process 6018. It may have died unexpectedly, or you may not have permission to debug the process.

First i had the error with NTFS on 2 disks but i deleted them and reformated to BTRFS and i get the same error.

No problem with windows

Once i saw user ADB in SMB diagnotics report.

joaopedrolages avatar Jun 03 '24 22:06 joaopedrolages

As I said above I need details as described in the ticket creation page and the support section of the docs. If the app is dying that's not mergerfs' fault. Nothing mergerfs does should cause an app to die. That would be a bug on their side.

trapexit avatar Jun 03 '24 23:06 trapexit

As described in the mergerfs wiki, I see that there may be problems with deleting or moving files in some file managers that do not follow the rfc when working with smb, or something like that. Therefore, I tried several file managers with a built-in smb client available in android, as a result, the 'amaze file manager' perfectly deletes files from mergerfs share and there are no errors.

serj-47 avatar Jun 05 '24 05:06 serj-47

I am experiencing the same issue as described in this bug report, so here are the details:

Describe the bug

When attempting to delete files on a Samba share hosting files in a mergerfs volume via the Android Solid Explorer client app, the Samba service crashes, and the client app complains about an unknown error. Despite the crash, the file is deleted from the mergerfs volume. The crash and associated error does not occur when deleting files on a Samba share hosting files in a regular volume.

As reported by @serj-47, the Amaze File Manager app does not cause Samba to crash.

Please be sure to use latest release of mergerfs to ensure the issue still exists. Not your distro's latest but the latest official release.

I am using mergerfs v2.40.2.

To Reproduce

Steps to reproduce the behavior. List all steps to reproduce. All settings.

Please simplify the reproduction as much as possible.

  • Unless it is dependenat on multiple branches, use a single branch
  • Reproduce with standard tooling if possible (touch,truncate,rm,rmdir,ln,etc.) Having to install 3rd party software will make debugging more difficult.

Relevant portion of /etc/fstab:

/dev/sdb2 /mnt/sdb btrfs defaults 0 0
/dev/sdc2 /mnt/sdc btrfs defaults 0 0
/dev/sdd2 /mnt/sdd btrfs defaults 0 0
/dev/sde2 /mnt/sde btrfs defaults 0 0
/mnt/sd* /mnt/media mergerfs category.create=eppfrd,minfreespace=20G,cache.files=off,dropcacheonclose=true 0 0

Relevant portion of /etc/samba/smb.conf:

[media]
  path = /mnt/media
  browseable = yes
  writable = yes
  read only = no
  valid users = schrock
  guest ok = no

[sdb]
  path = /mnt/sdb
  browseable = yes
  writable = yes
  read only = no
  valid users = schrock
  guest ok = no

Steps to reproduce:

  1. On the server, create a test file in the root of the mergerfs volume like so: touch /mnt/media/file0
  2. In the Android Solid Explorer app, connect to the Samba share media and delete file0.

Expected behavior

The file should be deleted cleanly without Samba crashing on the server or producing any errors on the client.

System information:

  • OS, kernel version: uname -a
    • Linux ruby 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • Samba version: samaba --version
    • Version 4.19.5-Ubuntu
  • mergerfs version: mergerfs -V
    • v2.40.2
  • mergerfs settings
    • category.create=eppfrd,minfreespace=20G,cache.files=off,dropcacheonclose=true
  • List of drives, filesystems, & sizes:
    • df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.4G  4.8M  1.4G   1% /run
efivarfs        128K   52K   72K  42% /sys/firmware/efi/efivars
/dev/sda2       232G   17G  215G   8% /
tmpfs           6.8G  4.0K  6.8G   1% /dev/shm
tmpfs           5.0M  8.0K  5.0M   1% /run/lock
b:c:d:e         6.4T  3.4T  3.0T  54% /mnt/media
/dev/sdd2       932G  426G  506G  46% /mnt/sdd
/dev/sdc2       932G  507G  425G  55% /mnt/sdc
/dev/sdb2       932G  467G  465G  51% /mnt/sdb
/dev/sde2       3.7T  2.1T  1.7T  56% /mnt/sde
/dev/sda1       1.1G  6.2M  1.1G   1% /boot/efi
tmpfs           1.4G  116K  1.4G   1% /run/user/114
tmpfs           1.4G  112K  1.4G   1% /run/user/1000
  • lsblk -f
NAME   FSTYPE FSVER LABEL                UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0                                                                               0   100% /snap/bare/5
loop1                                                                               0   100% /snap/core22/1380
loop2                                                                               0   100% /snap/core22/1439
loop3                                                                               0   100% /snap/firefox/4650
loop4                                                                               0   100% /snap/firefox/4698
loop5                                                                               0   100% /snap/gnome-42-2204/176
loop6                                                                               0   100% /snap/gtk-common-themes/1535
loop7                                                                               0   100% /snap/snapd/21759
sda
├─sda1 vfat   FAT32                      3E98-649D                                 1G     1% /boot/efi
└─sda2 btrfs                             cfd7182f-e551-4d10-bf97-e61d467d45b6  214.2G     7% /var/snap/firefox/common/host-hunspell
                                                                                             /
sdb
├─sdb1
└─sdb2 btrfs        Samsung 850 EVO 1    6029e008-55ce-a7cc-7b76-5e36e1abb80d  464.8G    50% /mnt/sdb
sdc
├─sdc1
└─sdc2 btrfs        Samsung 850 EVO 2    c9dd44b4-f81b-7d7e-4e16-e7ee75dce608  424.2G    54% /mnt/sdc
sdd
├─sdd1
└─sdd2 btrfs        Samsung 850 EVO 3圃ʥ d30929dc-bc1e-e033-5898-c4a5c8d4a129  505.3G    46% /mnt/sdd
sde
├─sde1
└─sde2 btrfs        Samsung 870 QVO 1    d669a52c-bcbf-4c71-d998-79223e280f61    1.6T    55% /mnt/sde
  • A strace of the application having a problem:
  • strace of mergerfs while app tried to do it's thing:
    • strace -fvTtt -s 256 -o /tmp/strace.mergerfs.txt -p <mergerfsPID>
  • Samba log:
[2024/08/13 14:08:22.224846,  0] source3/smbd/fd_handle.c:39(fd_handle_destructor)
  PANIC: assert failed at source3/smbd/fd_handle.c(39): (fh->fd == -1) || (fh->fd == AT_FDCWD)
[2024/08/13 14:08:22.224918,  0] lib/util/fault.c:178(smb_panic_log)
  ===============================================================
[2024/08/13 14:08:22.224937,  0] lib/util/fault.c:179(smb_panic_log)
  INTERNAL ERROR: assert failed: (fh->fd == -1) || (fh->fd == AT_FDCWD) in smbd (smbd[10.6.0.2]) (client [10.6.0.2]) pid 5801 (4.19.5-Ubuntu)
[2024/08/13 14:08:22.224951,  0] lib/util/fault.c:186(smb_panic_log)
  If you are running a recent Samba version, and if you think this problem is not yet fixed in the latest versions, please consider reporting this bug, see https://wiki.samba.org/index.php/Bug_Reporting
[2024/08/13 14:08:22.224963,  0] lib/util/fault.c:191(smb_panic_log)
  ===============================================================
[2024/08/13 14:08:22.224973,  0] lib/util/fault.c:192(smb_panic_log)
  PANIC (pid 5801): assert failed: (fh->fd == -1) || (fh->fd == AT_FDCWD) in 4.19.5-Ubuntu
[2024/08/13 14:08:22.225185,  0] lib/util/fault.c:303(log_stack_trace)
  BACKTRACE: 27 stack frames:
   #0 /usr/lib/x86_64-linux-gnu/samba/libgenrand-samba4.so.0(log_stack_trace+0x37) [0x7773fc0bb517]
   #1 /usr/lib/x86_64-linux-gnu/samba/libgenrand-samba4.so.0(smb_panic+0x15) [0x7773fc0bbd25]
   #2 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(+0x3d083) [0x7773fc479083]
   #3 /lib/x86_64-linux-gnu/libtalloc.so.2(+0x44a0) [0x7773fc05e4a0]
   #4 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(file_free+0xe1) [0x7773fc48eb81]
   #5 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(+0xb5e56) [0x7773fc4f1e56]
   #6 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(smbd_smb2_request_process_close+0x259) [0x7773fc4f2179]
   #7 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(smbd_smb2_request_dispatch+0x1b7f) [0x7773fc4e87bf]
   #8 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(+0xae069) [0x7773fc4ea069]
   #9 /lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_invoke_fd_handler+0x98) [0x7773fc04de48]
   #10 /lib/x86_64-linux-gnu/libtevent.so.0(+0xefda) [0x7773fc051fda]
   #11 /lib/x86_64-linux-gnu/libtevent.so.0(+0x6004) [0x7773fc049004]
   #12 /lib/x86_64-linux-gnu/libtevent.so.0(_tevent_loop_once+0x9b) [0x7773fc04abab]
   #13 /lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_loop_wait+0x2b) [0x7773fc04acfb]
   #14 /lib/x86_64-linux-gnu/libtevent.so.0(+0x6084) [0x7773fc049084]
   #15 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base-samba4.so.0(smbd_process+0x7eb) [0x7773fc4d534b]
   #16 smbd: client [10.6.0.2](+0xa5d6) [0x5dbb808d45d6]
   #17 /lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_invoke_fd_handler+0x98) [0x7773fc04de48]
   #18 /lib/x86_64-linux-gnu/libtevent.so.0(+0xefda) [0x7773fc051fda]
   #19 /lib/x86_64-linux-gnu/libtevent.so.0(+0x6004) [0x7773fc049004]
   #20 /lib/x86_64-linux-gnu/libtevent.so.0(_tevent_loop_once+0x9b) [0x7773fc04abab]
   #21 /lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_loop_wait+0x2b) [0x7773fc04acfb]
   #22 /lib/x86_64-linux-gnu/libtevent.so.0(+0x6084) [0x7773fc049084]
   #23 smbd: client [10.6.0.2](main+0x1432) [0x5dbb808d2032]
   #24 /lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca) [0x7773fbe2a1ca]
   #25 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b) [0x7773fbe2a28b]
   #26 smbd: client [10.6.0.2](_start+0x25) [0x5dbb808d2a95]
[2024/08/13 14:08:22.225325,  0] source3/lib/util.c:691(smb_panic_s3)
  smb_panic(): calling panic action [/usr/share/samba/panic-action 5801]
[2024/08/13 14:08:22.226736,  0] source3/lib/util.c:698(smb_panic_s3)
  smb_panic(): action returned status 0
[2024/08/13 14:08:22.226765,  0] source3/lib/dumpcore.c:317(dump_core)
  coredump is handled by helper binary specified at /proc/sys/kernel/core_pattern

schrock avatar Aug 13 '24 21:08 schrock

Thank you for the detailed report but samba is crashing itself. This really should be a report to them. Even if mergerfs was returning something odd it shouldn't panic. And looking at the strace shows smbd unlinking "file0" and then closing the fd. Both succeed and look fine. I just tried using Solid Explorer to create and delete a file using samba 4.19.6. No crash.

BTW, your traces are from different times. Your mergerfs trace is minutes after the smbd one.

trapexit avatar Aug 13 '24 21:08 trapexit

Thank you for looking at the log files. The thing I find interesting is that I have two Samba shares, one for a regular volume and another for the mergerfs volume. The Samba crash only occurs when deleting files from the mergerfs volume, not the regular volume, which makes me think mergerfs is doing something differently, triggering a different code path in Samba and causing it to crash. I will do some more debugging on my side and see if I can get Samba to log more information.

schrock avatar Aug 14 '24 00:08 schrock

At the end of the day a filesystem function is pretty straight forward in that it returns a standard Unix "return int or -1 with errno" and does the thing mentioned. And all of this goes through the kernel which has lots of validation checks. The only "different" thing mergerfs can be doing really is the filesystem behavior itself which of course could cause issues but those are Samba issues in that it is expecting something that may or many not be valid. It certainly shouldn't be issuing a panic because it got confused. Lots of filesystems are not fully POSIX compliant and should at most error gracefully.

I'm not saying this isn't something that could be addressed by mergerfs. What I'm saying is that step one is to understand why Samba panics and kills itself for something that simply can not worth doing that over. That trace from the log isn't detailed enough for me to guess why that is. You have to remember that Samba is complex and it isn't as simple as "you say delete files, samba issues delete, mergerfs delete." There could be hundreds of other syscalls and things going on otherwise.

trapexit avatar Aug 14 '24 12:08 trapexit

Although the results returned by different samba clients may fail when deleting files, in reality, it was successful and the files were deleted. Everything is normal on Windows. Samba did not report any errors. ES indicates failure, Mix indicates success. samba: ArchLinux samba 2:4.21.1-1 1730338954878

gloryandel avatar Oct 31 '24 01:10 gloryandel

Again... really need to know what the specifics are of the error from the app's perspective or why samba panics.

trapexit avatar Oct 31 '24 02:10 trapexit

Here's a logcat dump that I took of this issue occurring with Solid Explorer. My approach for reproducing this error was to create a folder called "test" and then delete it. When performing the deletion, the folder was removed but the operation was shown in the user interface to have been a failure.

komodo:/ # logcat -d --pid=9988
--------- beginning of main
06-23 12:05:33.630  9988  9988 D ViewRootImpl: Skipping stats log for color mode
06-23 12:05:33.714  9988  9988 D InsetsController: hide(ime(), fromIme=false)
06-23 12:05:33.714  9988  9988 I ImeTracker: pl.solidexplorer2:fec0a4e1: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
06-23 12:06:04.087  9988  9988 D VRI[SolidExplorer]: visibilityChanged oldVisibility=true newVisibility=false
06-23 12:06:06.106  9988 12975 I FA      : Application backgrounded at: timestamp_millis: 1750694764104
06-23 12:06:19.126  9988  9988 D ViewRootImpl: Skipping stats log for color mode
06-23 12:06:19.128  9988  9988 D VRI[SolidExplorer]: visibilityChanged oldVisibility=false newVisibility=true
06-23 12:06:19.135  9988  9988 W .solidexplorer2: type=1400 audit(0.0:157906): avc:  denied  { read } for  name="cache" dev="dm-7" ino=17 scontext=u:r:untrusted_app:s0:c125,c257,c512,c768 tcontext=u:object_r:cache_file:s0 tclass=lnk_file permissive=0 app=pl.solidexplorer2
06-23 12:06:19.155  9988  9988 W .solidexplorer2: type=1400 audit(0.0:157907): avc:  denied  { read } for  name="cache" dev="dm-7" ino=17 scontext=u:r:untrusted_app:s0:c125,c257,c512,c768 tcontext=u:object_r:cache_file:s0 tclass=lnk_file permissive=0 app=pl.solidexplorer2
06-23 12:06:19.578  9988  9988 D InsetsController: hide(ime(), fromIme=false)
06-23 12:06:19.578  9988  9988 I ImeTracker: pl.solidexplorer2:6ac959a2: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
komodo:/ # logcat -d --pid=9988
--------- beginning of main
06-23 12:06:04.087  9988  9988 D VRI[SolidExplorer]: visibilityChanged oldVisibility=true newVisibility=false
06-23 12:06:06.106  9988 12975 I FA      : Application backgrounded at: timestamp_millis: 1750694764104
06-23 12:06:19.126  9988  9988 D ViewRootImpl: Skipping stats log for color mode
06-23 12:06:19.128  9988  9988 D VRI[SolidExplorer]: visibilityChanged oldVisibility=false newVisibility=true
06-23 12:06:19.135  9988  9988 W .solidexplorer2: type=1400 audit(0.0:157906): avc:  denied  { read } for  name="cache" dev="dm-7" ino=17 scontext=u:r:untrusted_app:s0:c125,c257,c512,c768 tcontext=u:object_r:cache_file:s0 tclass=lnk_file permissive=0 app=pl.solidexplorer2
06-23 12:06:19.155  9988  9988 W .solidexplorer2: type=1400 audit(0.0:157907): avc:  denied  { read } for  name="cache" dev="dm-7" ino=17 scontext=u:r:untrusted_app:s0:c125,c257,c512,c768 tcontext=u:object_r:cache_file:s0 tclass=lnk_file permissive=0 app=pl.solidexplorer2
06-23 12:06:19.578  9988  9988 D InsetsController: hide(ime(), fromIme=false)
06-23 12:06:19.578  9988  9988 I ImeTracker: pl.solidexplorer2:6ac959a2: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
06-23 12:06:44.907  9988  9988 W HWUI    : Image decoding logging dropped!
06-23 12:06:44.907  9988  9988 W HWUI    : Image decoding logging dropped!
06-23 12:06:44.907  9988  9988 W HWUI    : Image decoding logging dropped!
06-23 12:06:44.910  9988  9988 W HWUI    : Image decoding logging dropped!
06-23 12:06:44.910  9988  9988 W HWUI    : Image decoding logging dropped!
06-23 12:06:44.943  9988  9988 W TextView: onProvideContentCaptureStructure(): calling assumeLayout()
06-23 12:06:44.952  9988  9988 I AssistStructure: Flattened final assist data: 25060 bytes, containing 2 windows, 206 views
06-23 12:06:45.427  9988  9988 I ImeTracker: pl.solidexplorer2:369ee2b4: onRequestShow at ORIGIN_CLIENT reason SHOW_SOFT_INPUT fromUser false
06-23 12:06:45.430  9988  9988 D InsetsController: show(ime(), fromIme=false)
--------- beginning of system
06-23 12:06:45.431  9988  9988 D InsetsController: Setting requestedVisibleTypes to -1 (was -9)
06-23 12:06:45.523  9988  9988 W .solidexplorer2: type=1400 audit(0.0:157910): avc:  denied  { read } for  name="cache" dev="dm-7" ino=17 scontext=u:r:untrusted_app:s0:c125,c257,c512,c768 tcontext=u:object_r:cache_file:s0 tclass=lnk_file permissive=0 app=pl.solidexplorer2
06-23 12:06:45.534  9988 13263 W InteractionJankMonitor: Initializing without READ_DEVICE_CONFIG permission. enabled=false, interval=1, missedFrameThreshold=3, frameTimeThreshold=64, package=pl.solidexplorer2
06-23 12:06:45.738  9988  9988 I ImeTracker: pl.solidexplorer2:369ee2b4: onShown
06-23 12:06:47.105  9988  9988 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=android.view.ImeBackAnimationController@168ef60
06-23 12:06:47.105  9988  9988 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=android.view.ViewRootImpl$$ExternalSyntheticLambda13@ee15fc9
06-23 12:06:47.108  9988 10009 D HWUI    : endAllActiveAnimators on 0xb400007281506010 (RippleDrawable) with handle 0xb4000072b14247d0
06-23 12:06:47.134  9988  9988 I ImeTracker: pl.solidexplorer2:803f30af: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
06-23 12:06:47.134  9988  9988 I ImeTracker: pl.solidexplorer2:803f30af: onFailed at PHASE_CLIENT_VIEW_SERVED
06-23 12:06:47.166  9988  9988 D InsetsController: hide(ime(), fromIme=false)
06-23 12:06:47.166  9988  9988 I ImeTracker: pl.solidexplorer2:5f46a27a: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
06-23 12:06:47.179  9988  9988 W RemoteInputConnectionImpl: requestCursorUpdates on inactive InputConnection
06-23 12:06:47.189  9988  9988 E ImeBackDispatcher: Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 176596859
06-23 12:06:47.199  9988  9988 W .solidexplorer2: type=1400 audit(0.0:157911): avc:  denied  { read } for  name="cache" dev="dm-7" ino=17 scontext=u:r:untrusted_app:s0:c125,c257,c512,c768 tcontext=u:object_r:cache_file:s0 tclass=lnk_file permissive=0 app=pl.solidexplorer2
06-23 12:06:47.257  9988  9988 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=android.view.ImeBackAnimationController@bf97bfd
06-23 12:06:52.946  9988  9988 W HWUI    : Image decoding logging dropped!
06-23 12:06:52.947  9988  9988 W HWUI    : Image decoding logging dropped!
06-23 12:06:52.974  9988  9988 W TextView: onProvideContentCaptureStructure(): calling assumeLayout()
06-23 12:06:53.021  9988  9988 D InsetsController: hide(ime(), fromIme=false)
06-23 12:06:53.021  9988  9988 I ImeTracker: pl.solidexplorer2:ea6fa725: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
06-23 12:06:54.168  9988  9988 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=android.view.ViewRootImpl$$ExternalSyntheticLambda13@c3f0181
06-23 12:06:54.172  9988 10009 D HWUI    : endAllActiveAnimators on 0xb400007281520f60 (RippleDrawable) with handle 0xb4000072b142b160
06-23 12:06:54.192  9988  9988 W HWUI    : Image decoding logging dropped!
06-23 12:06:54.198  9988  9988 D Solid Explorer: From: 1008 to: 509
06-23 12:06:54.199  9988  9988 D Solid Explorer: From: 509 to: 509
06-23 12:06:54.209  9988  9988 D InsetsController: hide(ime(), fromIme=false)
06-23 12:06:54.209  9988  9988 I ImeTracker: pl.solidexplorer2:b1af62eb: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
06-23 12:06:54.480  9988 13323 W SolidExplorer: Unknown error
06-23 12:06:54.480  9988 13323 W SolidExplorer: pl.solidexplorer.common.exceptions.SEException: Unknown error
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at pl.solidexplorer.plugins.network.smb.SMB2FileSystem.handleException(SMB2FileSystem.java:15)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at pl.solidexplorer.plugins.network.smb.SMB2FileSystem.deleteImpl(SMB2FileSystem.java:37)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at pl.solidexplorer.filesystem.FileSystem.delete(FileSystem.java:1)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at pl.solidexplorer.operations.impl.DeleteOperation.delete(DeleteOperation.java:110)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at pl.solidexplorer.operations.impl.DeleteOperation.doOperation(DeleteOperation.java:19)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at pl.solidexplorer.operations.OperationThread.run(OperationThread.java:33)
06-23 12:06:54.480  9988 13323 W SolidExplorer: Caused by: com.hierynomus.smbj.common.SMBRuntimeException: com.hierynomus.protocol.transport.TransportException: java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.SMBRuntimeException: com.hierynomus.protocol.transport.TransportException: java.io.EOFException: EOF while reading packet
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.share.Share.receive(Share.java:7)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.share.Share.receive(Share.java:1)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.share.Share.sendReceive(Share.java:10)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.share.Share.closeFileId(Share.java:23)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.share.Open.close(Open.java:5)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.share.DiskShare.rmdir(DiskShare.java:145)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at pl.solidexplorer.plugins.network.smb.SMB2FileSystem.deleteImpl(SMB2FileSystem.java:27)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         ... 4 more
06-23 12:06:54.480  9988 13323 W SolidExplorer: Caused by: com.hierynomus.protocol.transport.TransportException: java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.SMBRuntimeException: com.hierynomus.protocol.transport.TransportException: java.io.EOFException: EOF while reading packet
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.protocol.transport.TransportException$1.wrap(TransportException.java:4)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.protocol.transport.TransportException$1.wrap(TransportException.java:1)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.protocol.commons.concurrent.Futures.get(Futures.java:6)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.share.Share.receive(Share.java:5)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         ... 10 more
06-23 12:06:54.480  9988 13323 W SolidExplorer: Caused by: java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.SMBRuntimeException: com.hierynomus.protocol.transport.TransportException: java.io.EOFException: EOF while reading packet
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.protocol.commons.concurrent.PromiseBackedFuture.get(PromiseBackedFuture.java:4)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.protocol.commons.concurrent.CancellableFuture.get(CancellableFuture.java:2)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.protocol.commons.concurrent.Futures.get(Futures.java:5)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         ... 11 more
06-23 12:06:54.480  9988 13323 W SolidExplorer: Caused by: com.hierynomus.smbj.common.SMBRuntimeException: com.hierynomus.protocol.transport.TransportException: java.io.EOFException: EOF while reading packet
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.common.SMBRuntimeException$1.wrap(SMBRuntimeException.java:4)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.common.SMBRuntimeException$1.wrap(SMBRuntimeException.java:1)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.protocol.commons.concurrent.Promise.deliverError(Promise.java:8)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.connection.OutstandingRequests.handleError(OutstandingRequests.java:58)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.connection.Connection.handleError(Connection.java:3)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.transport.PacketReader.run(PacketReader.java:42)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at java.lang.Thread.run(Thread.java:1119)
06-23 12:06:54.480  9988 13323 W SolidExplorer: Caused by: com.hierynomus.protocol.transport.TransportException: java.io.EOFException: EOF while reading packet
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.transport.tcp.direct.DirectTcpPacketReader.readFully(DirectTcpPacketReader.java:26)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.transport.tcp.direct.DirectTcpPacketReader.readTcpHeader(DirectTcpPacketReader.java:4)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.transport.tcp.direct.DirectTcpPacketReader.doRead(DirectTcpPacketReader.java:1)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.transport.PacketReader.readPacket(PacketReader.java:1)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.transport.PacketReader.run(PacketReader.java:19)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         ... 1 more
06-23 12:06:54.480  9988 13323 W SolidExplorer: Caused by: java.io.EOFException: EOF while reading packet
06-23 12:06:54.480  9988 13323 W SolidExplorer:         at com.hierynomus.smbj.transport.tcp.direct.DirectTcpPacketReader.readFully(DirectTcpPacketReader.java:23)
06-23 12:06:54.480  9988 13323 W SolidExplorer:         ... 5 more
06-23 12:06:54.503  9988  9988 W .solidexplorer2: type=1400 audit(0.0:157913): avc:  denied  { read } for  name="cache" dev="dm-7" ino=17 scontext=u:r:untrusted_app:s0:c125,c257,c512,c768 tcontext=u:object_r:cache_file:s0 tclass=lnk_file permissive=0 app=pl.solidexplorer2

It is worth noting that I also encounter this behavior when using FolderSync as well and the error that I receive is the same.

I am not sure if this is the case for all of the various Android apps that users have encountered this issue with, but in the case of Solid Explorer and FolderSync, both of them seem to have a dependency on the smbj library. From a quick scan through the issue tracker, I found several tickets that seem to be related:

  • https://github.com/hierynomus/smbj/issues/841
  • https://github.com/hierynomus/smbj/issues/864
  • https://github.com/hierynomus/smbj/issues/867

What confuses me is that even though it does not appear to be a mergerfs issue, I did not encounter this until recently when I reconfigured my NAS to use it.

DavidBerdik avatar Jun 23 '25 16:06 DavidBerdik

@DavidBerdik What version of Samba are you using? As I pointed out earlier in the thread when using Samba 4.21.4 via container ghcr.io/servercontainers/samba:latest, mergerfs 2.40.2, recent Solid Explorer, and adding and deleting a file in a mergerfs pool leads to no crash in Samba. So perhaps it is fixed. The version shown above is 4.19.5-Ubuntu and the error PANIC (pid 5801): assert failed: (fh->fd == -1) || (fh->fd == AT_FDCWD). Which is clearly a Samba bug. It's certainly possible that mergerfs tickles the bug but ultimately a bug in Samba nonetheless. The stack trace that was offered prior doesn't really show enough for me to search their code and I'm simply not familiar with Samba's code to make it efficient for me to find it for them.

Besides this situation you can find https://lists.samba.org/archive/samba/2023-August/246199.html but no real resolution.

If people can reproduce this on a current release of Samba I could send an email to their list and ask for help tracking it down. But smbj should also look into what it sends that is different from other clients.

trapexit avatar Jun 24 '25 23:06 trapexit

I am using 4.17.12-Debian and as far as I am aware, it is not crashing when I encounter this error.

I wouldn't mind taking a shot at testing this with a newer version of Samba running in Docker, but at least for now, I have to wait.

DavidBerdik avatar Jun 25 '25 00:06 DavidBerdik

Do you have logs from Samba? Much of the reports seem to indicate a crash. Samba may be multi process so it could not be fully disappearing but that one worker.

I moved over on all my hosts to using the servercontainers/samba image. Find it easier to manage along with my other container services.

My docker/podman compose entry:

 samba:
    container_name: "samba"
    image: "ghcr.io/servercontainers/samba:latest"
    environment:
      - "SAMBA_GLOBAL_CONFIG_unix_SPACE_EXTENSIONS=yes"
      - "SAMBA_GLOBAL_CONFIG_use_SPACE_sendfile=yes"
      - "SAMBA_GLOBAL_CONFIG_deadtime=30"
      - "SAMBA_GLOBAL_CONFIG_socket_SPACE_options=IPTOS_LOWDELAY TCP_NODELAY IPTOS_THROUGHPUT"
      - "SAMBA_GLOBAL_CONFIG_server_SPACE_multi_SPACE_channel_SPACE_support=yes"
      - "SAMBA_VOLUME_CONFIG_tmp=[tmp]; path = /tmp; browseable = yes; writable = yes; read only = no; guest ok = yes;"
      - "SAMBA_VOLUME_CONFIG_media=[media]; path = /media; browseable = yes; writable = yes; read only = no; guest ok = yes;"
    network_mode: "host"
    restart: "unless-stopped"
    volumes:
      - /media:/media
      - /mnt:/mnt
      - /etc/avahi/services:/external/avahi

trapexit avatar Jun 25 '25 00:06 trapexit

@DavidBerdik I reached out to Samba folks. They asked that 4.21 or 4.22 be tested. 4.19 and before are considered unsupported.

trapexit avatar Jun 27 '25 11:06 trapexit

Do you have logs from Samba? Much of the reports seem to indicate a crash. Samba may be multi process so it could not be fully disappearing but that one worker.

I may have missed something but I did not see anything in the logs to indicate a crash.

I moved over on all my hosts to using the servercontainers/samba image. Find it easier to manage along with my other container services.

I use OpenMediaVault for my NAS but I'll try swapping my Samba setup out with the Docker image to test this and report back. I'm hoping to get to it this weekend at some point.

DavidBerdik avatar Jun 28 '25 06:06 DavidBerdik

Whether or not everyone is experiencing that is not clear but as shown above that is happening for some and would explain the dropped connection.

trapexit avatar Jun 28 '25 06:06 trapexit

I reached out to Samba folks. They asked that 4.21 or 4.22 be tested. 4.19 and before are considered unsupported.

I finally tested it using the Docker image that you referenced above (which uses Samba 4.21.4) and was not able to reproduce the issue, so I guess we have our answer.

Whether or not everyone is experiencing that is not clear but as shown above that is happening for some and would explain the dropped connection.

I suppose the best path forward is probably for the impacted users to request that the Samba version for their Linux distro of choice be updated.

DavidBerdik avatar Jun 28 '25 18:06 DavidBerdik

Thank you for confirming. I'll add something to the docs to recommend upgrading.

trapexit avatar Jun 28 '25 18:06 trapexit

You're welcome! 😁

If you are a Debian 12 (Bookworm) or OpenMediaVault 7 user, you can fix this issue by using the bookworm-backports package repo to update to a newer version of Samba. As of this post, the repo is shipping Samba 4.22.2. I have never used a Debian Backports repo before, but from what I understand, using it should not cause any issues when performing a major upgrade in the future.

DavidBerdik avatar Jun 28 '25 18:06 DavidBerdik