summaryrefslogtreecommitdiffstats
path: root/tests/basic/nfs-idle-connections.t
diff options
context:
space:
mode:
authorShreyas Siravara <sshreyas@fb.com>2016-03-28 14:17:53 -0700
committerJeff Darcy <jeff@pl.atyp.us>2017-09-12 15:12:21 +0000
commit14e24da1eb59a85fe99c22bafd8641ca2b75a923 (patch)
treee027476d10acffbd7d8415884901883f47fae2b7 /tests/basic/nfs-idle-connections.t
parent60b35dbfa42a65d81a18efda2776c0e733c4e769 (diff)
event: Idle connection management
Summary: - This diff adds support for detecting and tracking idle client connections. - It allows *service translators* (server, nfs) to opt-in to detect and close idle client connections. - Right now it explicitly restricts the service to NFS as a safety. Here are the debug logs when a client connection gets closed: [2016-03-29 17:27:06.154232] W [socket.c:2426:socket_timeout_handler] 0-socket: Shutting down idle client connection (idle=20s,fd=20,conn=[2401:db00:11:d0af:face:0:3:0:957]->[2401:db00:11:d0af:face:0:3:0:2049])! [2016-03-29 17:27:06.154292] D [event-epoll.c:655:__event_epoll_timeout_slot] 0-epoll: Connection on slot->fd=9 was idle for 20 seconds! [2016-03-29 17:27:06.163282] D [socket.c:629:__socket_rwv] 0-socket.nfs-server: EOF on socket [2016-03-29 17:27:06.163298] D [socket.c:2474:socket_event_handler] 0-transport: disconnecting now [2016-03-29 17:27:06.163316] D [event-epoll.c:614:event_dispatch_epoll_handler] 0-epoll: generation bumped on idx=9 from gen=4 to slot->gen=5, fd=20, slot->fd=20 Test Plan: - Used stuck NFS mounts to create idle clients and unstuck them. Reviewers: kvigor, rwareing Reviewed By: rwareing Subscribers: dld, moox, dph Differential Revision: https://phabricator.fb.com/D3112099 Change-Id: Ic06c89e03f87daabab7f07f892390edd1a1fcc20 Signed-off-by: Jeff Darcy <jdarcy@fb.com> Reviewed-on: https://review.gluster.org/18265 Reviewed-by: Jeff Darcy <jeff@pl.atyp.us> Tested-by: Jeff Darcy <jeff@pl.atyp.us> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'tests/basic/nfs-idle-connections.t')
-rw-r--r--tests/basic/nfs-idle-connections.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/basic/nfs-idle-connections.t b/tests/basic/nfs-idle-connections.t
new file mode 100644
index 00000000000..0a6d6e5daf7
--- /dev/null
+++ b/tests/basic/nfs-idle-connections.t
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+. $(dirname $0)/../nfs.rc
+
+cleanup;
+
+>/var/log/glusterfs/nfs.log;
+
+
+function check_connection_log ()
+{
+ if grep "$1" /var/log/glusterfs/nfs.log &> /dev/null; then
+ echo "Y"
+ else
+ echo "N"
+ fi;
+}
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2}
+TEST $CLI volume set $V0 nfs.disable off
+TEST $CLI volume start $V0
+TEST $CLI volume set $V0 nfs.client-max-idle-seconds 6;
+
+EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available;
+
+TEST mount -overs=3,noac,noacl,noatime,nolock,timeo=200 $HOSTNAME:/$V0 $N0
+
+EXPECT_WITHIN 25 "Y" check_connection_log "Found idle client connection";
+
+TEST $CLI volume set $V0 nfs.close-idle-clients on
+
+EXPECT_WITHIN 25 "Y" check_connection_log "Shutting down idle client connection";
+
+cleanup;