Bug 1465383

Summary: Segmentation fault in valueset_array_to_sorted_quick
Product: Red Hat Enterprise Linux 7 Reporter: Viktor Ashirov <vashirov>
Component: 389-ds-baseAssignee: mreynolds
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.4CC: lkrispen, msauton, nkinder, rmeggins, tbordaz
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.7.5-10.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1479757 (view as bug list) Environment:
Last Closed: 2018-04-10 14:18:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1479757    

Description Viktor Ashirov 2017-06-27 10:50:14 UTC
Description of problem:
During IPA tests segmentation fault has occurred.

Version-Release number of selected component (if applicable):
389-ds-base-1.3.6.1-16.el7.x86_64 

[New LWP 4433]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/ns-slapd -D /etc/dirsrv/slapd-example -i /var/run/dirsrv/slapd-exampl'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007fda01637bca in valueset_array_to_sorted_quick () from /usr/lib64/dirsrv/libslapd.so.0

Thread 1 (Thread 0x7fda01e808c0 (LWP 4433)):
#0  0x00007fda01637bca in valueset_array_to_sorted_quick () from /usr/lib64/dirsrv/libslapd.so.0
No symbol table info available.
#1  0x00007fda0163822c in slapi_valueset_add_attr_valuearray_ext () from /usr/lib64/dirsrv/libslapd.so.0
No symbol table info available.
#2  0x00007fda016383a4 in slapi_valueset_add_attr_value_ext () from /usr/lib64/dirsrv/libslapd.so.0
No symbol table info available.
#3  0x00007fda015c1537 in str2entry_dupcheck () from /usr/lib64/dirsrv/libslapd.so.0
No symbol table info available.
#4  0x00007fda015c1d85 in slapi_str2entry () from /usr/lib64/dirsrv/libslapd.so.0
No symbol table info available.
#5  0x00007fda015b9645 in dse_read_one_file () from /usr/lib64/dirsrv/libslapd.so.0
No symbol table info available.
#6  0x00007fda015b99cd in dse_read_file () from /usr/lib64/dirsrv/libslapd.so.0
No symbol table info available.
#7  0x00007fda0161dbc5 in init_schema_dse_ext () from /usr/lib64/dirsrv/libslapd.so.0
No symbol table info available.
#8  0x00007fda0161e00c in init_schema_dse () from /usr/lib64/dirsrv/libslapd.so.0
No symbol table info available.
#9  0x000055c2c1f6d0b1 in setup_internal_backends ()
No symbol table info available.
#10 0x000055c2c1f5ac67 in main ()
No symbol table info available.
From                To                  Syms Read   Shared Object Library
0x00007fda01aa5010  0x00007fda01aa6cf8  Yes (*)     /usr/lib64/dirsrv/libnunc-stans.so.0
0x00007fda0189b480  0x00007fda0189f665  Yes (*)     /usr/lib64/dirsrv/libsds.so.0
0x00007fda015a3bd0  0x00007fda0163ccaa  Yes (*)     /usr/lib64/dirsrv/libslapd.so.0
0x00007fda012fb9c0  0x00007fda0131ba7c  Yes (*)     /lib64/libtcmalloc.so.4
0x00007fda01023a10  0x00007fda0108ae8a  Yes (*)     /lib64/libkrb5.so.3
0x00007fda00dcf8c0  0x00007fda00dedc0f  Yes (*)     /lib64/libk5crypto.so.3
0x00007fda00bc8570  0x00007fda00bc9143  Yes (*)     /lib64/libcom_err.so.2
0x00007fda009665f0  0x00007fda009ac5b0  Yes (*)     /lib64/libpcre.so.1
0x00007fda00719af0  0x00007fda0074e014  Yes (*)     /lib64/libldap_r-2.4.so.2
0x00007fda004fc6d0  0x00007fda00503a22  Yes (*)     /lib64/liblber-2.4.so.2
0x00007fda002b8ec0  0x00007fda002e3b2f  Yes (*)     /lib64/libssl3.so
0x00007fd9fff9c740  0x00007fda0006f604  Yes (*)     /lib64/libnss3.so
0x00007fd9ffd7f510  0x00007fd9ffd80b76  Yes (*)     /lib64/libplc4.so
0x00007fd9ffb7af10  0x00007fd9ffb7bc78  Yes (*)     /lib64/libplds4.so
0x00007fd9ff948ca0  0x00007fd9ff968cbf  Yes (*)     /lib64/libnspr4.so
0x00007fd9ff723b60  0x00007fd9ff734fc3  Yes (*)     /lib64/libsasl2.so.3
0x00007fd9ff51b310  0x00007fd9ff51cdd4  Yes (*)     /lib64/libsvrcore.so.0
0x00007fd9ff302900  0x00007fd9ff30dce1  Yes (*)     /lib64/libpthread.so.0
0x00007fda01e956d0  0x00007fda01ead621  Yes (*)     /lib64/libsystemd.so.0
0x00007fd9ff0c1840  0x00007fd9ff0eb2c0  Yes (*)     /lib64/libevent-2.0.so.5
0x00007fd9feeb1e60  0x00007fd9feeb295e  Yes (*)     /lib64/libdl.so.2
0x00007fd9feb0d480  0x00007fd9fec53bcf  Yes (*)     /lib64/libc.so.6
0x00007fd9fe8d55b0  0x00007fd9fe8dc95e  Yes (*)     /lib64/libunwind.so.8
0x00007fd9fe627510  0x00007fd9fe68e5ba  Yes (*)     /lib64/libstdc++.so.6
0x00007fd9fe2cf370  0x00007fd9fe33a276  Yes (*)     /lib64/libm.so.6
0x00007fd9fe0b6af0  0x00007fd9fe0c62a5  Yes (*)     /lib64/libgcc_s.so.1
0x00007fd9fdea9890  0x00007fd9fdeb042b  Yes (*)     /lib64/libkrb5support.so.0
0x00007fd9fdca35b0  0x00007fd9fdca41cc  Yes (*)     /lib64/libkeyutils.so.1
0x00007fd9fda8b9d0  0x00007fd9fda9a7e1  Yes (*)     /lib64/libresolv.so.2
0x00007fda01caaaf0  0x00007fda01cc53c0  Yes (*)     /lib64/ld-linux-x86-64.so.2
0x00007fd9fd86a310  0x00007fd9fd87ece7  Yes (*)     /lib64/libsmime3.so
0x00007fd9fd640390  0x00007fd9fd64ed45  Yes (*)     /lib64/libnssutil3.so
0x00007fd9fd420170  0x00007fd9fd42c6f8  Yes (*)     /lib64/libz.so.1
0x00007fd9fd218250  0x00007fd9fd21b04c  Yes (*)     /lib64/librt.so.1
0x00007fd9fcfdfe50  0x00007fd9fcfe4aac  Yes (*)     /lib64/libcrypt.so.1
0x00007fd9fcddb620  0x00007fd9fcddce56  Yes (*)     /lib64/libcap.so.2
0x00007fd9fcbb9ac0  0x00007fd9fcbcf8c6  Yes (*)     /lib64/libselinux.so.1
0x00007fd9fc990080  0x00007fd9fc9a6860  Yes (*)     /lib64/liblzma.so.5
0x00007fd9fc713500  0x00007fd9fc763152  Yes (*)     /lib64/libgcrypt.so.11
0x00007fd9fc507a30  0x00007fd9fc5080a8  Yes (*)     /lib64/libgpg-error.so.0
0x00007fd9fc2c9870  0x00007fd9fc2f864a  Yes (*)     /lib64/libdw.so.1
0x00007fd9fc0bdba0  0x00007fd9fc0be309  Yes (*)     /lib64/libfreebl3.so
0x00007fd9fbeb93d0  0x00007fd9fbebb40c  Yes (*)     /lib64/libattr.so.1
0x00007fd9fbca3010  0x00007fd9fbcb2243  Yes (*)     /lib64/libelf.so.1
0x00007fd9fba91760  0x00007fd9fba9d5c0  Yes (*)     /lib64/libbz2.so.1
0x00007fd9fb87f1d0  0x00007fd9fb8863e1  Yes (*)     /lib64/libnss_files.so.2
0x00007fd9fb679160  0x00007fd9fb67ac43  Yes (*)     /usr/lib64/sasl2/libanonymous.so
0x00007fd9fb472500  0x00007fd9fb475147  Yes (*)     /usr/lib64/sasl2/libsasldb.so
0x00007fd9fb0e1440  0x00007fd9fb223fdb  Yes (*)     /lib64/libdb-5.3.so
0x00007fd9faeaab90  0x00007fd9faeaf3d3  Yes (*)     /usr/lib64/sasl2/libgssapiv2.so
0x00007fd9fac68650  0x00007fd9fac9aa1a  Yes (*)     /lib64/libgssapi_krb5.so.2
0x00007fd9faa57260  0x00007fd9faa594f3  Yes (*)     /usr/lib64/sasl2/libcrammd5.so
0x00007fd9fa849b70  0x00007fd9fa852253  Yes (*)     /usr/lib64/sasl2/libdigestmd5.so
0x00007fd9fa453f00  0x00007fd9fa58bbd7  Yes (*)     /lib64/libcrypto.so.10
(*): Shared library is missing debugging information.
$1 = 0x0
No symbol table is loaded.  Use the "file" command.
rax            0x55c2c49d4200	94295010656768
rbx            0xa	10
rcx            0x55c2c49d4380	94295010657152
rdx            0x55c2c491ee20	94295009914400
rsi            0x55c2c41fb190	94295002427792
rdi            0x7fff176b2018	140733586284568
rbp            0x1	0x1
rsp            0x7fff176b1ac0	0x7fff176b1ac0
r8             0x7fd9feeac9f0	140574261430768
r9             0x5d	93
r10            0x39	57
r11            0x246	582
r12            0x7fff176b2018	140733586284568
r13            0x0	0
r14            0x7fff176b1fb8	140733586284472
r15            0x7fff176b1fb8	140733586284472
rip            0x7fda01637bca	0x7fda01637bca <valueset_array_to_sorted_quick+122>
eflags         0x10212	[ AF IF RF ]
cs             0x33	51
ss             0x2b	43
ds             0x0	0
es             0x0	0
fs             0x0	0
gs             0x0	0
st0            *value not available*
st1            *value not available*
st2            *value not available*
st3            *value not available*
st4            *value not available*
st5            *value not available*
st6            *value not available*
st7            *value not available*
fctrl          *value not available*
fstat          *value not available*
ftag           *value not available*
fiseg          *value not available*
fioff          *value not available*
foseg          *value not available*
fooff          *value not available*
fop            *value not available*
xmm0           *value not available*
xmm1           *value not available*
xmm2           *value not available*
xmm3           *value not available*
xmm4           *value not available*
xmm5           *value not available*
xmm6           *value not available*
xmm7           *value not available*
xmm8           *value not available*
xmm9           *value not available*
xmm10          *value not available*
xmm11          *value not available*
xmm12          *value not available*
xmm13          *value not available*
xmm14          *value not available*
xmm15          *value not available*
mxcsr          *value not available*
Dump of assembler code for function valueset_array_to_sorted_quick:
   0x00007fda01637b50 <+0>:	push   %r15
   0x00007fda01637b52 <+2>:	mov    %rcx,%rax
   0x00007fda01637b55 <+5>:	mov    %rsi,%r15
   0x00007fda01637b58 <+8>:	push   %r14
   0x00007fda01637b5a <+10>:	push   %r13
   0x00007fda01637b5c <+12>:	push   %r12
   0x00007fda01637b5e <+14>:	mov    %rdi,%r12
   0x00007fda01637b61 <+17>:	push   %rbp
   0x00007fda01637b62 <+18>:	push   %rbx
   0x00007fda01637b63 <+19>:	sub    $0x38,%rsp
   0x00007fda01637b67 <+23>:	cmp    %rdx,%rax
   0x00007fda01637b6a <+26>:	mov    %rcx,0x28(%rsp)
   0x00007fda01637b6f <+31>:	lea    0x1(%rcx),%rcx
   0x00007fda01637b73 <+35>:	mov    %rdx,0x18(%rsp)
   0x00007fda01637b78 <+40>:	mov    %rcx,0x20(%rsp)
   0x00007fda01637b7d <+45>:	jbe    0x7fda01637c65 <valueset_array_to_sorted_quick+277>
   0x00007fda01637b83 <+51>:	mov    0x18(%rsp),%rax
   0x00007fda01637b88 <+56>:	mov    0x10(%r15),%rcx
   0x00007fda01637b8c <+60>:	mov    0x20(%rsp),%rbx
   0x00007fda01637b91 <+65>:	lea    -0x1(%rax),%rdi
   0x00007fda01637b95 <+69>:	mov    %rdi,0x10(%rsp)
   0x00007fda01637b9a <+74>:	mov    (%rcx,%rax,8),%rdi
   0x00007fda01637b9e <+78>:	shl    $0x3,%rax
   0x00007fda01637ba2 <+82>:	mov    %rax,0x8(%rsp)
   0x00007fda01637ba7 <+87>:	lea    0x0(,%rdi,8),%r13
   0x00007fda01637baf <+95>:	nop
   0x00007fda01637bb0 <+96>:	mov    0x8(%rsp),%rdi
   0x00007fda01637bb5 <+101>:	mov    0x18(%r15),%rax
   0x00007fda01637bb9 <+105>:	addq   $0x1,0x10(%rsp)
   0x00007fda01637bbf <+111>:	mov    (%rcx,%rdi,1),%rcx
   0x00007fda01637bc3 <+115>:	mov    (%rax,%r13,1),%rdx
   0x00007fda01637bc7 <+119>:	mov    %r12,%rdi
=> 0x00007fda01637bca <+122>:	mov    (%rax,%rcx,8),%rsi
   0x00007fda01637bce <+126>:	callq  0x7fda01637130 <valueset_value_cmp>
   0x00007fda01637bd3 <+131>:	test   %eax,%eax
   0x00007fda01637bd5 <+133>:	js     0x7fda01637c32 <valueset_array_to_sorted_quick+226>
   0x00007fda01637bd7 <+135>:	lea    -0x8(,%rbx,8),%r14
   0x00007fda01637bdf <+143>:	jmp    0x7fda01637bee <valueset_array_to_sorted_quick+158>
   0x00007fda01637be1 <+145>:	nopl   0x0(%rax)
   0x00007fda01637be8 <+152>:	mov    %rbp,%rbx
   0x00007fda01637beb <+155>:	mov    %rdx,%r14
   0x00007fda01637bee <+158>:	mov    0x10(%r15),%rsi
   0x00007fda01637bf2 <+162>:	mov    0x18(%r15),%rax
   0x00007fda01637bf6 <+166>:	mov    %r12,%rdi
   0x00007fda01637bf9 <+169>:	lea    -0x1(%rbx),%rbp
   0x00007fda01637bfd <+173>:	mov    (%rsi,%r14,1),%rsi
   0x00007fda01637c01 <+177>:	mov    (%rax,%r13,1),%rdx
   0x00007fda01637c05 <+181>:	mov    (%rax,%rsi,8),%rsi
   0x00007fda01637c09 <+185>:	callq  0x7fda01637130 <valueset_value_cmp>
   0x00007fda01637c0e <+190>:	test   %eax,%eax
   0x00007fda01637c10 <+192>:	lea    -0x8(%r14),%rdx
   0x00007fda01637c14 <+196>:	jg     0x7fda01637be8 <valueset_array_to_sorted_quick+152>
   0x00007fda01637c16 <+198>:	cmp    %rbp,0x10(%rsp)
   0x00007fda01637c1b <+203>:	jae    0x7fda01637c41 <valueset_array_to_sorted_quick+241>
   0x00007fda01637c1d <+205>:	mov    0x10(%r15),%rdi
   0x00007fda01637c21 <+209>:	mov    %rbp,%rbx
   0x00007fda01637c24 <+212>:	lea    (%rdi,%r14,1),%rsi
   0x00007fda01637c28 <+216>:	add    0x8(%rsp),%rdi
   0x00007fda01637c2d <+221>:	callq  0x7fda0159df00 <valueset_swap_values@plt>
   0x00007fda01637c32 <+226>:	mov    0x10(%r15),%rcx
   0x00007fda01637c36 <+230>:	addq   $0x8,0x8(%rsp)
   0x00007fda01637c3c <+236>:	jmpq   0x7fda01637bb0 <valueset_array_to_sorted_quick+96>
   0x00007fda01637c41 <+241>:	mov    0x18(%rsp),%rdx
   0x00007fda01637c46 <+246>:	mov    %rbp,%rcx
   0x00007fda01637c49 <+249>:	mov    %r15,%rsi
   0x00007fda01637c4c <+252>:	mov    %r12,%rdi
   0x00007fda01637c4f <+255>:	callq  0x7fda015a0460 <valueset_array_to_sorted_quick@plt>
   0x00007fda01637c54 <+260>:	cmp    %rbx,0x28(%rsp)
   0x00007fda01637c59 <+265>:	jbe    0x7fda01637c65 <valueset_array_to_sorted_quick+277>
   0x00007fda01637c5b <+267>:	mov    %rbx,0x18(%rsp)
   0x00007fda01637c60 <+272>:	jmpq   0x7fda01637b83 <valueset_array_to_sorted_quick+51>
   0x00007fda01637c65 <+277>:	add    $0x38,%rsp
   0x00007fda01637c69 <+281>:	pop    %rbx
   0x00007fda01637c6a <+282>:	pop    %rbp
   0x00007fda01637c6b <+283>:	pop    %r12
   0x00007fda01637c6d <+285>:	pop    %r13
   0x00007fda01637c6f <+287>:	pop    %r14
   0x00007fda01637c71 <+289>:	pop    %r15
   0x00007fda01637c73 <+291>:	retq   
End of assembler dump.

Comment 1 thierry bordaz 2017-06-27 11:11:24 UTC
    - The server crashes because valueset_value_syntax_cmp is unable to compare values
      valueset_array_to_sorted_quick is looping into a valueset swapping values in order to sort the valueset.
      Although the number of elements in the valueset is fixed, one of the loop does not end until valueset_value_syntax_cmp>0
      A problem is that valueset_value_syntax_cmp returns a negative value in case of failure.
      so there is now way to make a difference between  v1 < v2  and valueset_value_syntax_cmp can not compare v1 and v2.

(gdb) where
#0  0x00007fda01637bca in valueset_array_to_sorted_quick (a=0x7fff176b2018, vs=vs@entry=0x7fff176b1fb8, low=low@entry=0, high=9)
    at ldap/servers/slapd/valueset.c:1057
#1  0x00007fda01637cb2 in valueset_array_to_sorted (a=a@entry=0x7fff176b2018, vs=vs@entry=0x7fff176b1fb8)
    at ldap/servers/slapd/valueset.c:1034
#2  0x00007fda0163822c in slapi_valueset_add_attr_valuearray_ext (a=a@entry=0x7fff176b2018, vs=vs@entry=0x7fff176b1fb8, 
    addvals=addvals@entry=0x7fff176b1b90, naddvals=naddvals@entry=1, flags=flags@entry=1, dup_index=dup_index@entry=0x0)
    at ldap/servers/slapd/valueset.c:1181
#3  0x00007fda016383a4 in slapi_valueset_add_attr_value_ext (a=a@entry=0x7fff176b2018, vs=vs@entry=0x7fff176b1fb8, 
    addval=<optimized out>, flags=flags@entry=1) at ldap/servers/slapd/valueset.c:1231
#4  0x00007fda015c1537 in str2entry_dupcheck (rawdn=rawdn@entry=0x0, s=<optimized out>, 
    s@entry=0x55c2c4a08000 "# 00core.ldif - Required Schema", flags=flags@entry=192, read_stateinfo=read_stateinfo@entry=-1)
    at ldap/servers/slapd/entry.c:1119
#5  0x00007fda015c1d85 in slapi_str2entry (s=s@entry=0x55c2c4a08000 "# 00core.ldif - Required Schema", flags=flags@entry=192)
    at ldap/servers/slapd/entry.c:1344
#6  0x00007fda015b9645 in dse_read_one_file (pdse=pdse@entry=0x55c2c4928190, 
    filename=0x55c2c4910a50 "/usr/share/dirsrv/schema/00core.ldif", pb=pb@entry=0x7fff176b8010, primary_file=primary_file@entry=0)
    at ldap/servers/slapd/dse.c:764
#7  0x00007fda015b99cd in dse_read_file (pdse=0x55c2c4928190, pb=pb@entry=0x7fff176b8010) at ldap/servers/slapd/dse.c:852
#8  0x00007fda0161dbc5 in init_schema_dse_ext (schemadir=<optimized out>, be=be@entry=0x0, 
    local_pschemadse=local_pschemadse@entry=0x7fda01894750 <pschemadse>, schema_flags=schema_flags@entry=16)
    at ldap/servers/slapd/schema.c:5375
#9  0x00007fda0161e00c in init_schema_dse (configdir=configdir@entry=0x55c2c491de00 "/etc/dirsrv/slapd-example")
    at ldap/servers/slapd/schema.c:5447
#10 0x000055c2c1f6d0b1 in setup_internal_backends (configdir=0x55c2c491de00 "/etc/dirsrv/slapd-example")
    at ldap/servers/slapd/fedse.c:1789
#11 0x000055c2c1f5ac67 in main (argc=5, argv=0x7fff176b9758) at ldap/servers/slapd/main.c:772

    # valueset has 10 values
(gdb) print *vs
$58 = {num = 10, max = 16, sorted = 0x55c2c49d4280, va = 0x55c2c49d4200}
    
    # we are in the first loop valueset_value_cmp<0 (j was not yet decrease)
(gdb) print high
$60 = 9
(gdb) print j
$56 = 10

    # looping while valueset_value_cmp(a, vs->va[vs->sorted[i]], vs->va[pivot]) < 0
    # 'i' was getting above the vs->num number of values
(gdb) print i
$57 = 16

    - When the crash occurs we can see those logs
[27/May/2017:15:56:28.098829688 -0400] - ERR - valueset_value_syntax_cmp - slapi_attr_values2keys_sv failed for type attributetypes

    - The reason why valueset_value_cmp fails is unknown but is likely related to
      the fact DS fails to retrieve/open dse.ldif
      Note there are attempts to restore it from dse.ldif.tmp and dse.ldif.bak

[27/May/2017:15:56:28.091842082 -0400] - ERR - dse_check_file - The configuration file /etc/dirsrv/slapd-example/dse.ldif was not restored from backup /etc/dirsrv/slapd-example/dse.ldif.tmp, error -1
[27/May/2017:15:56:28.091987636 -0400] - ERR - dse_check_file - The configuration file /etc/dirsrv/slapd-example/dse.ldif was not restored from backup /etc/dirsrv/slapd-example/dse.ldif.bak, error -1
[27/May/2017:15:56:28.091996309 -0400] - ERR - slapd_bootstrap_config - The given config file /etc/dirsrv/slapd-example/dse.ldif could not be accessed, Netscape Portable Runtime error -5950 (File not found.)

    - How to fix this
        - I guess that if restore dse.ldif succeeds, valueset_value_syntax_cmp will succeed and there is no crash
        - We can do hardening in valueset_array_to_sorted_quick so that if 'i' keeps <= high and 'j' keeps >=0
          But in case the loops hit that hardening, we know that the valueset is not sorted but this failure is not reported to the caller
        - valueset_value_syntax_cmp should be able to report a failure

Comment 2 Ludwig 2017-06-27 11:27:18 UTC
I think if the dse.ldif does not exist the syntax plugins will not be initialized and syntax_cmp will not work.
The core issue seems to be the missing dse.ldif, maybe this is a variant of #49131 or #49298. 
I wouldn't invest too much into the valuset sorting and try to get the dse.ldif stuff right. Anf there is no dse.ldif, we should just stop and not attempt to read schema or whatever

Comment 3 wibrown@redhat.com 2017-07-05 06:34:53 UTC
Is this fixed now with the dse.ldif fsync fix?

Comment 4 Viktor Ashirov 2017-07-19 08:20:56 UTC
(In reply to wibrown from comment #3)
> Is this fixed now with the dse.ldif fsync fix?

This issue was found in the downstream bits, fsync fix has not landed there yet.
Also I don't have a standalone reproducer to retest it with a scratch build.

Comment 5 wibrown@redhat.com 2017-07-19 23:09:05 UTC
Okay. I think we'll just have to assume that the fsync fix will work, and they have to wait for 1.3.7. Does that sound acceptable? Do you think this is important enough for a backport?

Comment 6 Viktor Ashirov 2017-07-20 09:40:50 UTC
I think fsync fix is good to have, especially that by default RHEL7 and latest Fedoras use XFS as a default FS, and we saw this issue most often on XFS (this bug included).

Though I'd really like to fix valueset_value_syntax_cmp so it doesn't assume a lot of things when dse.ldif is missing. I don't know how much effort/time it will take to fix and if it worth it.

Comment 7 Ludwig 2017-07-20 09:44:12 UTC
we sure can try to harden valueset_value_syntax_cmp(), but if dse.ldif is missing we should't even get to a place where we call it. 
So we should look into startup code and stop in that case instead of continuing and running into these issues.

Comment 12 Viktor Ashirov 2017-11-21 16:23:04 UTC
Build tested:
389-ds-base-1.3.7.5-10.el7.x86_64

With the missing dse* files server no longer crashes, but instead logs EMERGENCY message:

Nov 21 10:07:34 rhel7.example.com ds_systemd_ask_password_acl[11773]: grep: /etc/dirsrv/slapd-rhel7/dse.ldif: No such file or directory
Nov 21 10:07:34 rhel7.example.com ns-slapd[11778]: [21/Nov/2017:10:07:34.312060355 -0500] - INFO - dse_check_file - The config /etc/dirsrv/slapd-rhel7/dse.ldif can not be accessed. Attempting restore ... (reason: 0)
Nov 21 10:07:34 rhel7.example.com ns-slapd[11778]: [21/Nov/2017:10:07:34.312199471 -0500] - INFO - dse_check_file - The backup /etc/dirsrv/slapd-rhel7/dse.ldif.bak can not be accessed. Check it exists and permissions.
Nov 21 10:07:34 rhel7.example.com ns-slapd[11778]: [21/Nov/2017:10:07:34.312205141 -0500] - ERR - slapd_bootstrap_config - No valid configurations can be accessed! You must restore /etc/dirsrv/slapd-rhel7/dse.ldif from backup!
Nov 21 10:07:34 rhel7.example.com ns-slapd[11778]: [21/Nov/2017:10:07:34.312209129 -0500] - EMERG - main - The configuration files in directory /etc/dirsrv/slapd-rhel7 could not be read or were not found.  Please refer to the error log or output for more information.
Nov 21 10:07:34 rhel7.example.com systemd[1]: dirsrv: main process exited, code=exited, status=1/FAILURE
Nov 21 10:07:34 rhel7.example.com systemd[1]: Failed to start 389 Directory Server rhel7..


Automated tests also pass:
============================= test session starts ==============================
platform linux -- Python 3.6.3, pytest-3.2.5, py-1.5.2, pluggy-0.4.0 -- /opt/rh/rh-python36/root/usr/bin/python3
cachedir: .cache
metadata: {'Python': '3.6.3', 'Platform': 'Linux-3.10.0-768.el7.x86_64-x86_64-with-redhat-7.5-Maipo', 'Packages': {'pytest': '3.2.5', 'py': '1.5.2', 'pluggy': '0.4.0'}, 'Plugins': {'metadata': '1.5.0', 'html': '1.16.0'}}
389-ds-base: 1.3.7.5-10.el7
nss: 3.34.0-0.1.beta1.el7
nspr: 4.17.0-1.el7
openldap: 2.4.44-9.el7
svrcore: 4.1.3-2.el7

rootdir: /export/tests, inifile:
plugins: metadata-1.5.0, html-1.16.0
collected 2 items                                                               

suites/config/removed_config_49298_test.py::test_restore_config PASSED
suites/config/removed_config_49298_test.py::test_removed_config PASSED

========================== 2 passed in 16.16 seconds ===========================


Marking as VERIFIED.

Comment 16 errata-xmlrpc 2018-04-10 14:18:12 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://access.redhat.com/errata/RHBA-2018:0811