<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Package: slapd<o:p></o:p></p>
<p class="MsoNormal">Version: 2.4.31-2+deb7u2<o:p></o:p></p>
<p class="MsoNormal"><span style="color:black">+X-Debbugs-CC: ryan@openldap.org<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Greetings,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I've noticed that sometimes the "slapd" fails to stop. I can reproduce the problem only on machines with multiple cores  (more than 2) when there are many<o:p></o:p></p>
<p class="MsoNormal">concurrent connections and the server is under a heavy "stress" .<o:p></o:p></p>
<p class="MsoNormal">Note that I tried the current standard version (2.4.31-deb7u2) as well as the wheezy-backports -  2.4.31+really2.4.40+dfsg-1+deb8u1~bpo70+1 .<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In the logs i was able to identify the first "shutdown" log:<o:p></o:p></p>
<p class="MsoNormal">   daemon: shutdown requested and initiated<o:p></o:p></p>
<p class="MsoNormal">However the next expected shutdown logs are missing ("waiting for ...operations/tasks to finish" and "slapd stopped") .
<o:p></o:p></p>
<p class="MsoNormal">Hence, i believe that it's related to closing the sockets/listeners (this is my guess based on the source code, however i never debugged/proved it).<o:p></o:p></p>
<p class="MsoNormal">Please note that i'm using virtual environment so i was able to reproduce it only when i used more than 4 cores.<o:p></o:p></p>
<p class="MsoNormal">Also please note that my system is a customized (hardened) Debian wheezy (7.9) and I built the slapd from the Debian sources (apt-get source …) .<o:p></o:p></p>
<p class="MsoNormal">I REALLY (!!) hope that this is valid bug since I’m surprised that I’m the only one who encountered this situation.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">How to reproduced it:<o:p></o:p></p>
<p class="MsoNormal">-------------------------------<o:p></o:p></p>
<p class="MsoNormal">I guess that there are a few ways to reproduce it , I managed to easily reproduce it with two terminates – one producing “ldapsearch” stress and the other restarting slapd :<o:p></o:p></p>
<p class="MsoNormal">- Open two terminals.<o:p></o:p></p>
<p class="MsoNormal">- On terminal #1 i'm just manually running  "slapd restart" commands:<o:p></o:p></p>
<p class="MsoNormal">   # /etc/init.d/slapd status ; /etc/init.d/slapd restart<o:p></o:p></p>
<p class="MsoNormal">- On terminal #2 i'm running a infinite loops of simple "ldapsearch" (100<o:p></o:p></p>
<p class="MsoNormal">concurrent processes running loops of ldapsearch). Terminal #2 is trying to<o:p></o:p></p>
<p class="MsoNormal">simulate many concurrent read operations. see "more information" later for the<o:p></o:p></p>
<p class="MsoNormal">exact scripts that i used.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Incorrect behavior:<o:p></o:p></p>
<p class="MsoNormal">-------------------------<o:p></o:p></p>
<p class="MsoNormal">The "slapd restart" works a few times, and then the "stop" operation fails.<o:p></o:p></p>
<p class="MsoNormal">The stop continues to fail even if i stop all "stress" and terminate all<o:p></o:p></p>
<p class="MsoNormal">ldapsearch/connections  (CPU is 99% idle !)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Expected Behavior:<o:p></o:p></p>
<p class="MsoNormal">-------------------------<o:p></o:p></p>
<p class="MsoNormal">All slapd stop/restart operations complete successfully <o:p>
</o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">More Information (optional – my exact scripts):<o:p></o:p></p>
<p class="MsoNormal">----------------------------------------------------------------<o:p></o:p></p>
<p class="MsoNormal">On terminal#2 i used a very simple script to generate a "read only" stress:<o:p></o:p></p>
<p class="MsoNormal"># cat > ldaploop.sh << EOF<o:p></o:p></p>
<p class="MsoNormal">#!/bin/sh<o:p></o:p></p>
<p class="MsoNormal">while true ; do  ldapsearch -x -Z ; done<o:p></o:p></p>
<p class="MsoNormal">EOF<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"># cat > manyloops.sh << "EOF"<o:p></o:p></p>
<p class="MsoNormal">#!/bin/sh<o:p></o:p></p>
<p class="MsoNormal">for i in `seq 1 100` ; do ( ./ldaploop.sh &) ; done<o:p></o:p></p>
<p class="MsoNormal">EOF<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">As previously mentioned, i ran the "manyloops.sh" to generate 100 running<o:p></o:p></p>
<p class="MsoNormal">processes where each one simply runs "ldapsearch" (locally).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">thanks in advance,<o:p></o:p></p>
<p class="MsoNormal">Zvika Ferentz<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>