[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: Review Request 128890: Make e.g. Baloo::Query thread safe.
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2016-09-11 18:40:27
Message-ID: 20160911184027.10006.86098 () mimi ! kde ! org
[Download RAW message or body]

--===============1856200180735673633==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit



> On Sept. 11, 2016, 6:32 p.m., Anthony Fieroni wrote:
> > src/engine/database.cpp, line 128
> > <https://git.reviewboard.kde.org/r/128890/diff/1/?file=476743#file476743line128>
> > 
> > It's needed *m_env = 0;*
> > Or you can add method close to call it in all way.
> 
> Christoph Cullmann wrote:
> I don't understand the comment ;)
> 1) m_env != null means valid atm, therefore I can call here close
> 2) after this, the destructor is over, no need to null it, if you access the \
> database object after/during destruction, all is lost. 
> Anthony Fieroni wrote:
> Missing m_env = 0 after closing call. It can lead crash it future use.

Ah ;=) I see, I misread the line!
Thanks


- Christoph


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128890/#review99103
-----------------------------------------------------------


On Sept. 11, 2016, 6:27 p.m., Christoph Cullmann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128890/
> -----------------------------------------------------------
> 
> (Updated Sept. 11, 2016, 6:27 p.m.)
> 
> 
> Review request for KDE Frameworks, Plasma and Boudhayan Gupta.
> 
> 
> Repository: baloo
> 
> 
> Description
> -------
> 
> lmdb itself is thread safe (e.g. you can use the same env in multiple threads).
> Unfortunately, the Baloo::Database itself not, as open() might race against other \
> open calls (we have one unique db object in baloo). 
> => add non-recursive mutex (recursive mutex not needed, one just must avoid to call \
> isOpen() or path() inside open, that is done, else no unit test works). 
> 
> Diffs
> -----
> 
> src/engine/database.h e3bb175 
> src/engine/database.cpp ec7ae2e 
> 
> Diff: https://git.reviewboard.kde.org/r/128890/diff/
> 
> 
> Testing
> -------
> 
> Unit tests still work.
> 
> 
> Thanks,
> 
> Christoph Cullmann
> 
> 


--===============1856200180735673633==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit




<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">  \
<tr>  <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/128890/">https://git.reviewboard.kde.org/r/128890/</a>
  </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On September 11th, 2016, 6:32 p.m. UTC, <b>Anthony \
Fieroni</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  


<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/128890/diff/1/?file=476743#file476743line128" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/engine/database.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">bool \
Database::open(OpenMode mode)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">120</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="n">mdb_env_close</span><span class="p">(</span><span \
class="n">m_env</span><span class="p">);</span></pre></td>  <th bgcolor="#f0f0f0" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">128</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="n">mdb_env_close</span><span class="p">(</span><span \
class="n">m_env</span><span class="p">);</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">It's \
needed <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: normal;">m_env = 0;</em> Or you can add method close to call it \
in all way.</p></pre>  </blockquote>



 <p>On September 11th, 2016, 6:35 p.m. UTC, <b>Christoph Cullmann</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I \
don't understand the comment ;) 1) m_env != null means valid atm, therefore I can \
call here close 2) after this, the destructor is over, no need to null it, if you \
access the database object after/during destruction, all is lost.</p></pre>  \
</blockquote>





 <p>On September 11th, 2016, 6:37 p.m. UTC, <b>Anthony Fieroni</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">Missing m_env = 0 after closing call. It can lead crash it future \
use.</p></pre>  </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">Ah ;=) I see, I misread the line! Thanks</p></pre>
<br />




<p>- Christoph</p>


<br />
<p>On September 11th, 2016, 6:27 p.m. UTC, Christoph Cullmann wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;">  <tr>
  <td>

<div>Review request for KDE Frameworks, Plasma and Boudhayan Gupta.</div>
<div>By Christoph Cullmann.</div>


<p style="color: grey;"><i>Updated Sept. 11, 2016, 6:27 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
baloo
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">lmdb itself is thread safe (e.g. you can use the same \
env in multiple threads). Unfortunately, the Baloo::Database itself not, as open() \
might race against other open calls (we have one unique db object in baloo).</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">=&gt; add non-recursive mutex (recursive mutex not needed, one just must \
avoid to call isOpen() or path() inside open, that is done, else no unit test \
works).</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Unit tests still work.</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/engine/database.h <span style="color: grey">(e3bb175)</span></li>

 <li>src/engine/database.cpp <span style="color: grey">(ec7ae2e)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/128890/diff/" style="margin-left: \
3em;">View Diff</a></p>






  </td>
 </tr>
</table>







  </div>
 </body>
</html>


--===============1856200180735673633==--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic