cifsd-team / ksmbd

ksmbd kernel server(SMB/CIFS server)
154 stars 23 forks source link

Video freeze with some software #510

Closed erdoukki closed 3 years ago

erdoukki commented 3 years ago

A new question about the buffers value ! How can I determine the best values... I have some freeze at showing videos directly, but not with all software... VLC (VideoLan) works fine, but FileExplorer (IOS/iPAD) do not... How can I change the values of buffers in /etc/ksmbd/smb.conf.template to fix this issue ? I experiment this on OpenWrt snashot with KSMBD 3.3.7 on NSA310S and LS421DE hardware NAS.

erdoukki commented 3 years ago
[global]
    netbios name = |NAME|
    server string = |DESCRIPTION|
    workgroup = |WORKGROUP|
    interfaces = |INTERFACES|
    bind interfaces only = yes
    ipc timeout = 20
    deadtime = 15
    map to guest = Bad User
#   smb2 max read = 64K
#   smb2 max write = 64K
#   smb2 max trans = 64K
#   cache read buffers = no
#   cache trans buffers = no
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=8192 SO_SNDBUF=8192

[IPC$]
    guest ok = yes

I found this on the samba ubuntu wiki fr... It give me the best results and stop the freeze my videos... Commenting the buffers options also give me better results !

neheb commented 3 years ago

ping @Andy2244

namjaejeon commented 3 years ago

Sorry, I can not understand. after removing buffer options in smb.conf, problem is fixed ? If yes, Can you check if cache read/trans buffers option is related to this issue ?

mmakassikis commented 3 years ago

socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=8192 SO_SNDBUF=8192

You can remove the line above as it doesn't do anything.

Are you testing VLC / FileExplorer from the same device ? Since the streaming is over WiFi, are you testing from the same distance ? Are you using 2.4GHz or 5GHz channels ?

In your initial test, did you have "smb2 max read/write/trans" set to 64K ? If yes, why ? The defaults are much higher. "cache read buffers" are also enabled by default. Did you intentionally disable them ?

erdoukki commented 3 years ago

socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=8192 SO_SNDBUF=8192 You can remove the line above as it doesn't do anything.

Okay

Are you testing VLC / FileExplorer from the same device ? Since the streaming is over WiFi, are you testing from the same distance ? Are you using 2.4GHz or 5GHz channels ?

Yes... same iPad/iOS Device

In your initial test, did you have "smb2 max read/write/trans" set to 64K ? If yes, why ? The defaults are much higher. "cache read buffers" are also enabled by default. Did you intentionally disable them ?

Yes, because it's the default in OpenWrt package. all are not modified from the default value of the package of OpenWrt. What are the real default values to try, please ?

Are theses the default and recommended values ? https://github.com/cifsd-team/ksmbd-tools/blob/master/Documentation/configuration.txt

erdoukki commented 3 years ago

Sorry, I can not understand. after removing buffer options in smb.conf, problem is fixed ?

It looks like yes !

If yes, Can you check if cache read/trans buffers option is related to this issue ?

How can I do this ?

Andy2244 commented 3 years ago

If yes, why ? The defaults are much higher.

As noted we had to reduce the large buffers early on, since we still support a lot of 16/32 MB Ram devices so multiple 4MB buffers are risky as defaults. Thats why i asked namjaejeon for sane good minimal values, which i think where also based on what samba4 uses, which is what we have now. The logic here was that my tests showed good or identical results compared to the large defaults, but i did not retest this for a long time and also could not check/test every use-case or client.

What would be nice if erdoukki could test what the minimal buffer sizes are that still solve this issue? If only large buffers solve the issue i can add some logic that sets the sizes based on the device used, as in small for 16MB devices, medium for 32MB and maybe default on 64MB+ devices.

PS: If i remember correctly, specifically the cache read buffers, cache trans buffers caused some issues.

namjaejeon commented 3 years ago

there is no known issue from cache read/trans buffers now. @erdoukki at least, you should share error logs with us. and I am still confusing how you improve this issue when changing smb.conf. can you share before/after your smb.conf ?

erdoukki commented 3 years ago

on OpenWrt, no logs... Not working smb.conf.template :

[global]
    netbios name = |NAME|
    server string = |DESCRIPTION|
    workgroup = |WORKGROUP|
    interfaces = |INTERFACES|
    bind interfaces only = yes
    ipc timeout = 20
    deadtime = 15
    map to guest = Bad User
    smb2 max read = 64K
    smb2 max write = 64K
    smb2 max trans = 64K
    cache read buffers = no
    cache trans buffers = no
[IPC$]
    guest ok = yes

The working smb.conf.template :

[global]
    netbios name = |NAME|
    server string = |DESCRIPTION|
    workgroup = |WORKGROUP|
    interfaces = |INTERFACES|
    bind interfaces only = yes
    ipc timeout = 20
    deadtime = 15
    map to guest = Bad User
#   smb2 max read = 64K
#   smb2 max write = 64K
#   smb2 max trans = 64K
#   cache read buffers = no
#   cache trans buffers = no
[IPC$]
    guest ok = yes
neheb commented 3 years ago

that IPC hack shouldn't be needed anymore. I pushed the fixed version of ksmbd-tools.

erdoukki commented 3 years ago

that IPC hack shouldn't be needed anymore. I pushed the fixed version of ksmbd-tools.

Thanks, will try !

namjaejeon commented 3 years ago

@erdoukki could you try problem is fixed with the following smb.conf also ?

[global]
    netbios name = |NAME|
    server string = |DESCRIPTION|
    workgroup = |WORKGROUP|
    interfaces = |INTERFACES|
    bind interfaces only = yes
    ipc timeout = 20
    deadtime = 15
    map to guest = Bad User
#   smb2 max read = 64K
#   smb2 max write = 64K
#   smb2 max trans = 64K
    cache read buffers = no
    cache trans buffers = no
erdoukki commented 3 years ago

@namjaejeon tested okay with this configs ! @neheb I also confirm than upgrading to ksmb-server 3.3.8 fix the ipc guest... (no more configs needed)