Bug 47835 - SIGSEGV slapd translog.c:230 - failed to write /var/lib/univention-ldap/last_id
SIGSEGV slapd translog.c:230 - failed to write /var/lib/univention-ldap/last_id
Status: NEW
Product: UCS
Classification: Unclassified
Component: LDAP
UCS 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS maintainers
UCS maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-09-19 12:17 CEST by Philipp Hahn
Modified: 2022-12-08 17:10 CET (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 7: Crash: Bug causes crash or data loss
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.080
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2018-09-19 12:17:26 CEST
5b9e294c OVER: get_last_id
5b9e294c OVER: unable to open transaction file
5b9e294c OVER: Could not find last ID, lastid seems to be: "-1"

Thread 4 "slapd2" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff6ccd0700 (LWP 30144)]
___fprintf_chk (fp=fp@entry=0x0, flag=flag@entry=1, format=format@entry=0x7fffeded5b71 "%ld") at fprintf_chk.c:30
30      fprintf_chk.c: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0  ___fprintf_chk (fp=fp@entry=0x0, flag=flag@entry=1, format=format@entry=0x7fffeded5b71 "%ld") at fprintf_chk.c:30
#1  0x00007fffeded55fe in fprintf (__fmt=0x7fffeded5b71 "%ld", __stream=0x0) at /usr/include/x86_64-linux-gnu/bits/stdio2.h:97
#2  translog_response (op=<optimized out>, rs=<optimized out>) at ../../../../../servers/slapd/overlays/translog.c:230
#3  0x00005555555fa7b8 in over_back_response (op=0x7fff640008f0, rs=0x7fff6cccfab0) at ../../../../servers/slapd/backover.c:237
#4  0x000055555559d608 in slap_response_play (op=op@entry=0x7fff640008f0, rs=rs@entry=0x7fff6cccfab0) at ../../../../servers/slapd/result.c:508
#5  0x000055555559db6c in send_ldap_response (op=op@entry=0x7fff640008f0, rs=rs@entry=0x7fff6cccfab0) at ../../../../servers/slapd/result.c:583
#6  0x000055555559e553 in slap_send_ldap_result (op=0x7fff640008f0, rs=0x7fff6cccfab0) at ../../../../servers/slapd/result.c:861
#7  0x00007fffee0e4f06 in mdb_add (op=0x7fff640008f0, rs=0x7fff6cccfab0) at ../../../../../servers/slapd/back-mdb/add.c:435
#8  0x00005555555fb410 in overlay_op_walk (op=op@entry=0x7fff640008f0, rs=0x7fff6cccfab0, which=op_add, oi=0x5555559f74a0, on=<optimized out>)
    at ../../../../servers/slapd/backover.c:677
#9  0x00005555555fb56d in over_op_func (op=0x7fff640008f0, rs=<optimized out>, which=<optimized out>) at ../../../../servers/slapd/backover.c:730
#10 0x0000555555594011 in fe_op_add (op=0x7fff640008f0, rs=0x7fff6cccfab0) at ../../../../servers/slapd/add.c:334
#11 0x0000555555594e70 in do_add (op=0x7fff640008f0, rs=0x7fff6cccfab0) at ../../../../servers/slapd/add.c:194
#12 0x000055555558d6d6 in connection_operation (ctx=ctx@entry=0x7fff6cccfc10, arg_v=arg_v@entry=0x7fff640008f0) at ../../../../servers/slapd/connection.c:1158
#13 0x000055555558d9b5 in connection_read_thread (ctx=0x7fff6cccfc10, argv=0xc) at ../../../../servers/slapd/connection.c:1294
#14 0x00007ffff7b9784a in ?? () from /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2
#15 0x00007ffff5d99494 in start_thread (arg=0x7fff6ccd0700) at pthread_create.c:333
#16 0x00007ffff5adbacf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Missing error handling in case the file cannot be opened for writing:

229»·file = fopen( "/var/lib/univention-ldap/last_id", "w" );
230»·fprintf( file, "%ld", lastid );                                                                                                                                            
231»·fclose( file );
Comment 1 Ingo Steuwer univentionstaff 2020-09-01 10:35:56 CEST
Do we know how to reproduce this?
Comment 2 Philipp Hahn univentionstaff 2020-09-01 11:09:32 CEST
(In reply to Ingo Steuwer from comment #1)
> Do we know how to reproduce this?

I do not remember the exact cause, as it happened once to me 2y ago.

fopen() returns NULL on errors, e.g. it might happen if slapd is run with user "openldap" instead of "root" as UCS still does by default, see Bug #18500 for that.
Or do a "chattr +i /var/lib/univention-ldap/last_id".