Bug 12608 - smbd stops reading SMB2 packets when the output queue grows too large.
smbd stops reading SMB2 packets when the output queue grows too large.
Status: RESOLVED FIXED
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services
unspecified
All All
: P5 normal
: ---
Assigned To: Karolin Seeger
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-03-02 17:12 UTC by Jeremy Allison
Modified: 2017-03-13 08:20 UTC (History)
3 users (show)

See Also:


Attachments
Patch for 4.4, 4.5 and 4.6 cherry-picked from master (2.31 KB, patch)
2017-03-03 12:14 UTC, Ralph Böhme
jra: review+
slow: review? (metze)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2017-03-02 17:12:55 UTC
Reported on the list:

From: Chenyehua via samba <samba@lists.samba.org>
To: "'samba@lists.samba.org'" <samba@lists.samba.org>
Subject: [Samba] The connection would be broken when read rate is too big

Hi samba-team,
I met a problem recently:

Problem Description:
The connection would be broken when read rate is too big.

Environment:
Samba 4.3.11
Ubuntu server 14.04

Configuration:
usershare allow guests = yes
   max protocol = SMB3
   large readwrite = yes
   use sendfile = yes
   aio read size = 1024
   oplocks = yes
   deadtime = 10
   aio write behind = true
   clustering = yes
   store dos attributes = yes
   vfs objects = acl_xattr
   socket options = TCP_NODELAY SO_RCVBUF=131072 SO_SNDBUF=131072
   ctdbd socket = /var/run/ctdb/ctdbd.socket
   log level = 2
   security = user

I add some logs, found when the send queue is more than the max, it won’t allocate memory to the state->req in smbd_smb2_r
+equest_next_incoming function.
Then, the smbd_smb2_io_handler function mark the fd to not readable because state->req == NULL, and never mark it to reada
+ble again.
Then the Request Expiration Timer will break the connection.

I don’t know why the fd is marked to readable when the send queue is more than the max.
Or why mark the fd readable but not allocate memory to the state->req.

My solution:
Allocate memory to the state->req before return when the send queue is more than the max in smbd_smb2_request_next_incomin
+g function.

Could you give us some help about the problem.

Br
Thanks.
Comment 1 Ralph Böhme 2017-03-03 12:14:25 UTC
Created attachment 13013 [details]
Patch for 4.4, 4.5 and 4.6 cherry-picked from master
Comment 2 Jeremy Allison 2017-03-03 16:46:43 UTC
Comment on attachment 13013 [details]
Patch for 4.4, 4.5 and 4.6 cherry-picked from master

LGTM.
Comment 3 Jeremy Allison 2017-03-03 16:47:10 UTC
Reassigning to Karolin for inclusion in 4.6.next, 4.5.next, 4.4.next.
Comment 4 Karolin Seeger 2017-03-06 07:56:25 UTC
(In reply to Jeremy Allison from comment #3)
Pushed to autobuild-v4-{6,5,4}-test.
Comment 5 Karolin Seeger 2017-03-13 08:20:48 UTC
(In reply to Karolin Seeger from comment #4)
Pushed to all branches.
Closing out bug report.

Thanks!