Skip to content

Commit

Permalink
Issue 5984 - Crash when paged result search are abandoned - fix2 (#5987)
Browse files Browse the repository at this point in the history
Chasing several rabbits at the same time is a bad idea !
and I mixed branches and unwillingly pushed one commit for #5980 in #5984
just before the PR #5985 merge ! -:(
Hopefully it does not break anything but just logs some useless crap if instance fails to starts.
Anyway This commit reverts the change about __init.py
and also do a minor code cleanup (removed a trailing space) in abandon.c

Issue #5984

Reviewed by: @tbordaz Thanks !

(cherry picked from commit df7dd83)
  • Loading branch information
progier389 committed Nov 21, 2023
1 parent dc09132 commit 382003b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
2 changes: 1 addition & 1 deletion ldap/servers/slapd/abandon.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ do_abandon(Slapi_PBlock *pb)
struct timespec hr_time_end;
int nentries;
int opid;
} o_copy;
} o_copy;

slapi_pblock_get(pb, SLAPI_OPERATION, &pb_op);
slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
Expand Down
27 changes: 1 addition & 26 deletions src/lib389/lib389/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,24 +1048,6 @@ def close(self):

self.state = DIRSRV_STATE_OFFLINE

def dump_errorlog(self):
'''
Its logs all errors messages within the error log that occured
after the last startup.
'''
if os.path.isfile(self.errlog):
lines = []
with open(self.errlog, 'r') as file:
for line in file:
if "starting up" in line:
lines = []
for key in ( 'DEBUG', 'INFO', 'NOTICE', 'WARN' ):
if key in line:
lines.append(line)
break
for line in lines:
self.log.error(line)

def start(self, timeout=120, post_open=True):
'''
It starts an instance and rebind it. Its final state after rebind
Expand All @@ -1089,13 +1071,7 @@ def start(self, timeout=120, post_open=True):
if self.with_systemd():
self.log.debug("systemd status -> True")
# Do systemd things here ...
try:
subprocess.check_output(["systemctl", "start", "dirsrv@%s" % self.serverid], stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
self.dump_errorlog()
self.log.error('Failed to start dirsrv@%s: "%s"' % (self.serverid, e.output.decode()))
self.log.error(e)
raise ValueError('Failed to start DS')
subprocess.check_output(["systemctl", "start", "dirsrv@%s" % self.serverid], stderr=subprocess.STDOUT)
else:
self.log.debug("systemd status -> False")
# Start the process.
Expand All @@ -1119,7 +1095,6 @@ def start(self, timeout=120, post_open=True):
self.log.debug("DEBUG: starting with %s" % cmd)
output = subprocess.check_output(*cmd, env=env, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
self.dump_errorlog()
self.log.error('Failed to start ns-slapd: "%s"' % e.output.decode())
self.log.error(e)
raise ValueError('Failed to start DS')
Expand Down

0 comments on commit 382003b

Please sign in to comment.