Bug 12469 - CTDB lock helper getting stuck trying to lock a record
Summary: CTDB lock helper getting stuck trying to lock a record
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: CTDB (show other bugs)
Version: 4.5.2
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-14 07:29 UTC by Amitay Isaacs
Modified: 2017-02-13 15:59 UTC (History)
5 users (show)

See Also:


Attachments
Patches for v4-6 (18.45 KB, patch)
2017-01-15 23:52 UTC, Amitay Isaacs
martins: review+
Details
Patches for v4-5 (18.60 KB, patch)
2017-01-15 23:52 UTC, Amitay Isaacs
martins: review+
Details
skip build of test_mutex_raw if robust mutexes are not available (1.30 KB, patch)
2017-01-30 12:08 UTC, Björn Baumbach
no flags Details
Extra patches for master (2.25 KB, patch)
2017-01-31 05:55 UTC, Amitay Isaacs
no flags Details
Extra patches for master (2.43 KB, patch)
2017-01-31 06:21 UTC, Amitay Isaacs
no flags Details
Extra patches for master (3.07 KB, patch)
2017-01-31 06:42 UTC, Amitay Isaacs
no flags Details
Extra patches for v4-6 (3.42 KB, patch)
2017-02-01 05:37 UTC, Amitay Isaacs
metze: review+
Details
Extra patches for v4-5 (3.42 KB, patch)
2017-02-01 05:37 UTC, Amitay Isaacs
metze: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Amitay Isaacs 2016-12-14 07:29:15 UTC
This is due to a bug related to robust mutex scheduling in Linux/glibc.
Comment 1 Amitay Isaacs 2016-12-14 07:30:25 UTC
This bug has been reported to redhat bugzilla.

https://bugzilla.redhat.com/show_bug.cgi?id=1401665
Comment 2 Amitay Isaacs 2017-01-15 23:52:16 UTC
Created attachment 12830 [details]
Patches for v4-6
Comment 3 Amitay Isaacs 2017-01-15 23:52:54 UTC
Created attachment 12831 [details]
Patches for v4-5
Comment 4 Martin Schwenke 2017-01-16 02:33:43 UTC
Hi Karolin,

This is ready for 4.5 and 4.6.

Thanks...
Comment 5 Karolin Seeger 2017-01-24 19:59:58 UTC
(In reply to Martin Schwenke from comment #4)
Pushed to autobuild-v4-{6,5}-test.
Comment 6 Karolin Seeger 2017-01-27 05:12:14 UTC
(In reply to Karolin Seeger from comment #5)
Pushed to both branches.
Closing out bug report.

Thanks!
Comment 7 Karolin Seeger 2017-01-30 11:29:28 UTC
Patch seems to brake build on e.g. SUSE 11.1:

[2788/3997] Compiling ctdb/tests/src/test_mutex_raw.c
../ctdb/tests/src/test_mutex_raw.c: In function 'main':
../ctdb/tests/src/test_mutex_raw.c:205: error: 'PTHREAD_MUTEX_ROBUST' undeclared (first use in this function)
../ctdb/tests/src/test_mutex_raw.c:205: error: (Each undeclared identifier is reported only once
../ctdb/tests/src/test_mutex_raw.c:205: error: for each function it appears in.)
Waf: Leaving directory `/root/build/4.5.5-13/BUILD/samba-4.5.5/bin'
Build failed:  -> task failed (err #1):
        {task: cc test_mutex_raw.c -> test_mutex_raw_110.o}
make: *** [all] Error 1
Comment 8 Björn Baumbach 2017-01-30 12:08:39 UTC
Created attachment 12866 [details]
skip build of test_mutex_raw if robust mutexes are not available

With the attached patch waf skips the build of the test if robust mutexes are not available.
Comment 9 Stefan Metzmacher 2017-01-30 12:45:07 UTC
(In reply to Björn Baumbach from comment #8)

Hi Björn,

can you change this pass
enabled=bld.env.HAVE_ROBUST_MUTEXES
to bld.SAMBA_BINARY() ?

Thanks!
metze
Comment 10 Björn Baumbach 2017-01-30 12:46:18 UTC
Comment on attachment 12866 [details]
skip build of test_mutex_raw if robust mutexes are not available

Does not work, sorry.
Comment 11 Amitay Isaacs 2017-01-31 04:00:04 UTC
(In reply to Björn Baumbach from comment #10)

Why does the patch not work?
Comment 12 Amitay Isaacs 2017-01-31 05:55:35 UTC
Created attachment 12870 [details]
Extra patches for master
Comment 13 Amitay Isaacs 2017-01-31 05:56:31 UTC
Hi Karolin,

Can you check if the extra patches fix the issue?
Comment 14 Stefan Metzmacher 2017-01-31 06:09:06 UTC
(In reply to Amitay Isaacs from comment #13)

The test should use the following includes

#include "replace.h"
#include "system/filesys.h"
#include "system/wait.h"
#include "system/threads.h"

and don't use the _np() functions directly.
Comment 15 Amitay Isaacs 2017-01-31 06:21:29 UTC
Created attachment 12874 [details]
Extra patches for master
Comment 16 Amitay Isaacs 2017-01-31 06:23:17 UTC
(In reply to Stefan Metzmacher from comment #14)

Yes, I wrote this code for standalone testing.

I see that system/threads.h takes care of defining PTHREAD_MUTEX_ROBUST and pthread_mutexattr_setrobust().  I have updated the patches.
Comment 17 Stefan Metzmacher 2017-01-31 06:31:21 UTC
(In reply to Amitay Isaacs from comment #16)

You should also remove the pthread_mutex_consistent_np() prototype
and use pthread_mutex_consistent() instead.
Comment 18 Amitay Isaacs 2017-01-31 06:42:03 UTC
Created attachment 12879 [details]
Extra patches for master
Comment 19 Amitay Isaacs 2017-01-31 06:42:24 UTC
(In reply to Stefan Metzmacher from comment #17)

Done.
Comment 20 Stefan Metzmacher 2017-01-31 07:07:34 UTC
(In reply to Amitay Isaacs from comment #19)

Thanks! Pushed to autobuild.
Comment 21 Amitay Isaacs 2017-02-01 05:37:05 UTC
Created attachment 12892 [details]
Extra patches for v4-6
Comment 22 Amitay Isaacs 2017-02-01 05:37:45 UTC
Created attachment 12893 [details]
Extra patches for v4-5
Comment 23 Amitay Isaacs 2017-02-01 13:45:46 UTC
Karolin,

The extra patches should fix the build on suse 11.1 or any other older glibc distro.

They are ready for 4.5 and 4.6.
Comment 24 Karolin Seeger 2017-02-02 11:52:38 UTC
(In reply to Amitay Isaacs from comment #23)
Pushed to autobuild-v4-{5,6}-test.
Comment 25 Karolin Seeger 2017-02-13 15:59:09 UTC
(In reply to Karolin Seeger from comment #24)
Pushed to both branches.
Closing out bug report.

Thanks!