RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1081940 - clvmd hangs sometimes if a client disappears without first explicitly releasing its locks
Summary: clvmd hangs sometimes if a client disappears without first explicitly releasi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.0
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Alasdair Kergon
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 1205796
TreeView+ depends on / blocked
 
Reported: 2014-03-28 08:54 UTC by Peter Rajnoha
Modified: 2023-03-08 07:26 UTC (History)
8 users (show)

Fixed In Version: lvm2-2.02.126-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 12:45:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Backtraces from clvmd and pvscan when the hang appears (4.87 KB, text/plain)
2015-07-22 14:03 UTC, Peter Rajnoha
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2147 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2015-11-19 11:11:07 UTC

Description Peter Rajnoha 2014-03-28 08:54:07 UTC
Nenad hit this recently (it's reproducible with both current RHEL7 build as well as current upstream):

[root@rhel7-b ~]# pvscan | true
(hang)

[root@rhel7-c ~]# pvscan | true
(hang)

[root@rhel7-d ~]# pvscan | true
[root@rhel7-d ~]# 


One always passsed, the rest is always hung. This is not reproducible if not using the pipe. I'll try to gather some more debug info...

Comment 1 Peter Rajnoha 2014-03-28 08:56:33 UTC
So far the problem is only with the pvscan.

Comment 2 Nenad Peric 2014-03-28 09:35:34 UTC
Since piped pvscan is used with bash completion, it could potentially cause temporary lockups in cluster if an error in bash completion code is present.

Comment 3 RHEL Program Management 2014-04-05 05:47:36 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 4 Alasdair Kergon 2014-07-16 00:12:04 UTC
Yes, please grab some diagnostics and work out what it is waiting for:  ps listing (incl wchan), lsof, run with -vvvv, strace etc.

Comment 7 Peter Rajnoha 2014-08-28 13:20:50 UTC
The pvscan drops from the hang after about 30-40 seconds.

[0] rhel7-b/~ # time pvscan | true

real    0m0.224s
user    0m0.007s
sys     0m0.014s


[0] rhel7-c/~ # time pvscan | true

real    0m33.215s
user    0m0.012s
sys     0m0.008s

[0] rhel7-d/~ # time pvscan | true

real    0m33.044s
user    0m0.009s
sys     0m0.014s


Strace shows it waits on read from clvmd.sock after sending request to lock #global lock, this is _send_request fn in cluster_locking.c, the "reread" label in the code:


write(2, "Setting global/wait_for_locks to"..., 34Setting global/wait_for_locks to 1) = 34
write(2, "\n", 1)                       = 1
write(2, "#locking/locking.c:271       ", 29#locking/locking.c:271       ) = 29
write(2, "Cluster locking selected.", 25Cluster locking selected.) = 25
write(2, "\n", 1)                       = 1
socket(PF_LOCAL, SOCK_STREAM, 0)        = 3
connect(3, {sa_family=AF_LOCAL, sun_path="/run/lvm/clvmd.sock"}, 110) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
write(2, "#locking/cluster_locking.c:502  "..., 37#locking/cluster_locking.c:502       ) = 37
write(2, "Locking VG P_#global PW (VG) (0x"..., 34Locking VG P_#global PW (VG) (0x4)) = 34
write(2, "\n", 1)                       = 1
write(3, "3\0\0\0\0\0\0\0\0\0\0\0\v\0\0\0\0\4\4P_#global\0", 29) = 29
read(3,

Comment 13 Peter Rajnoha 2015-07-22 14:03:28 UTC
Created attachment 1054860 [details]
Backtraces from clvmd and pvscan when the hang appears

The pvscan is waiting on clvmd and clvmd is waiting on:

(gdb) bt
#0  0x00007f470c4226d5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f470c634a68 in sync_write_v6 () from /lib64/libdlm.so.3
#2  0x00007f470c6355c0 in ls_lock_v6 () from /lib64/libdlm.so.3
#3  0x00007f470c6356a5 in ls_lock () from /lib64/libdlm.so.3
#4  0x00007f470c6358fd in dlm_ls_lock_wait () from /lib64/libdlm.so.3
#5  0x00007f470d713f6a in _lock_resource (resource=0x7f470f023763 "P_#global", mode=4, flags=0, lockid=0x7f470d550cb4) at clvmd-corosync.c:448
#6  0x00007f470d70e57d in lock_vg () at clvmd-command.c:224
#7  do_pre_command () at clvmd-command.c:259
#8  0x00007f470d70fe40 in pre_and_post_thread (arg=0x7f470f023600) at clvmd.c:1694
#9  0x00007f470c41edc5 in start_thread () from /lib64/libpthread.so.0
#10 0x00007f470bf481bd in clone () from /lib64/libc.so.6

It's possible the pipe used in reproducer is just a thing that changes timing to make this bug appear. I'll try to dig deeper, possibly finding simpler reproducer. I don't quite believe the pipe could have direct effect here for this bug.

Comment 14 Peter Rajnoha 2015-07-22 14:06:32 UTC
(In reply to Peter Rajnoha from comment #13)
> Created attachment 1054860 [details]
> Backtraces from clvmd and pvscan when the hang appears

This was with 3 nodes where 1 always passed (both pvscan and clvmd finished with clear state), the other two got blocked with the backtrace above. I'll try to reproduce with 2 nodes only...

Comment 15 Peter Rajnoha 2015-07-23 09:47:09 UTC
Also easily reproducible with 2 nodes.

This looks like the P_#global lock was not released properly on node which finished the pvscan (rhel7-c in the log below - the lock still registered as "Granted") and another node is just waiting for this lock to be released (rhel7-b - "Waiting"):

rhel7-b/~ # dlm_tool lockdebug -v clvmd

Resource len  9  "P_#global"
Master:2         
Waiting
00000001 -- (PW) Master:   2 00000002          
time 0002079452097660 flags 00000000 00000001 bast 0 0


rhel7-c/~ # dlm_tool lockdebug -v clvmd

Resource len  9  "P_#global"
Master           
Granted
00000001 PW                                    
time 0002077280469236 flags 00000000 00000001 bast 0 0
Waiting
00000002 -- (PW) Remote:   1 00000001          
time 0002077302832343 flags 00000000 00010001 bast 0 0


I'm looking for the exact code path taken to check why the lock was not released properly...

Comment 16 Peter Rajnoha 2015-07-23 12:46:45 UTC
There's unhandled signal from broken pipe which kills the LVM command *before* it has a chance to unlock the VG, keeping the locks around and blocking other commands:

write(1, "  PV /dev/vda2   VG rhel   lvm2 "..., 55) = -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=1849, si_uid=0} ---
+++ killed by SIGPIPE +++

The "true" command (and maybe others too) just doesn't care what's in the pipe, breaking the pipe. I suppose we should add a signal handler here to cover this case...

Comment 17 Peter Rajnoha 2015-07-23 13:14:23 UTC
The cleanup on clvmd side in case client disconnects immediately doesn't seem to cleanup the lock that was initiated by the client... Inspecting more...

Comment 18 Alasdair Kergon 2015-07-23 15:40:20 UTC
The code that schedules the necessary clean up after a client disappears does not work properly and locks do not get released at the right time.

Comment 19 Alasdair Kergon 2015-07-23 22:27:57 UTC
Let's try this one:
  https://lists.fedorahosted.org/pipermail/lvm2-commits/2015-July/004323.html

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=be662439331abf6ccb16dd996bfe15eb613b4e53
Commit:        be662439331abf6ccb16dd996bfe15eb613b4e53
Parent:        57534733b7750f17f5ffa115306dcb650d8015b9
Author:        Alasdair G Kergon <agk at redhat.com>
AuthorDate:    Thu Jul 23 23:10:16 2015 +0100
Committer:     Alasdair G Kergon <agk at redhat.com>
CommitterDate: Thu Jul 23 23:10:16 2015 +0100

clvmd: Fix freeze if client dies holding locks.

Simply running concurrent copies of 'pvscan | true' is enough to make
clvmd freeze: pvscan exits on the EPIPE without first releasing the
global lock.

clvmd notices the client disappear but because the cleanup code that
releases the locks is triggered from within some processing after the
next select() returns, and that processing can 'break' after doing just
one action, it sometimes never releases the locks to other clients.

Move the cleanup code before the select.
Check all fds after select().
Improve some debug messages and warn in the unlikely event that
select() capacity could soon be exceeded.
---
 WHATS_NEW                     |    1 +
 daemons/clvmd/clvmd-command.c |    4 +-
 daemons/clvmd/clvmd.c         |   67 +++++++++++++++++++++++++++--------------
 3 files changed, 47 insertions(+), 25 deletions(-)

Comment 22 Nenad Peric 2015-08-12 13:02:10 UTC
tested with multiple simultaneous pvscans with (and without) pipes on a 3-node cluster. 
All returned without issues. 

Marking VERIFIED with:


lvm2-2.02.127-1.el7    BUILT: Mon Aug 10 10:22:35 CEST 2015
lvm2-libs-2.02.127-1.el7    BUILT: Mon Aug 10 10:22:35 CEST 2015
lvm2-cluster-2.02.127-1.el7    BUILT: Mon Aug 10 10:22:35 CEST 2015
device-mapper-1.02.104-1.el7    BUILT: Mon Aug 10 10:22:35 CEST 2015
device-mapper-libs-1.02.104-1.el7    BUILT: Mon Aug 10 10:22:35 CEST 2015
device-mapper-event-1.02.104-1.el7    BUILT: Mon Aug 10 10:22:35 CEST 2015
device-mapper-event-libs-1.02.104-1.el7    BUILT: Mon Aug 10 10:22:35 CEST 2015
device-mapper-persistent-data-0.5.4-1.el7    BUILT: Fri Jul 17 15:56:22 CEST 2015
cmirror-2.02.127-1.el7    BUILT: Mon Aug 10 10:22:35 CEST 2015

Comment 23 errata-xmlrpc 2015-11-19 12:45:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2147.html


Note You need to log in before you can comment on or make changes to this bug.