[issue11369] Add caching for the isEnabledFor() computation

William Hart report at bugs.python.org
Mon Mar 14 07:30:20 CET 2011


William Hart <whart222 at gmail.com> added the comment:

Vinay:

No, I haven't tried this in multi-threaded applications.  You're correct
that this would require locks around the global data.

--Bill

On Thu, Mar 10, 2011 at 3:16 AM, Vinay Sajip <report at bugs.python.org> wrote:

>
> Vinay Sajip <vinay_sajip at yahoo.co.uk> added the comment:
>
> Bill,
>
> I was looking at this patch again, and I'm not sure about thread safety.
> The correctness of the caching depends on manager.status, which is state
> which is potentially shared across threads. There are no interlocks around
> it, so with the patch as it stands, ISTM it's possible in a multi-threaded
> application to get stale information. Has your patch been used in
> multi-threaded applications?
>
> ----------
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue11369>
> _______________________________________
>

----------
Added file: http://bugs.python.org/file21107/unnamed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11369>
_______________________________________
-------------- next part --------------
Vinay:<br><br>No, I haven&#39;t tried this in multi-threaded applications.  You&#39;re correct that this would require locks around the global data.<br><br>--Bill<br><br><div class="gmail_quote">On Thu, Mar 10, 2011 at 3:16 AM, Vinay Sajip <span dir="ltr">&lt;<a href="mailto:report at bugs.python.org">report at bugs.python.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im"><br>
Vinay Sajip &lt;<a href="mailto:vinay_sajip at yahoo.co.uk">vinay_sajip at yahoo.co.uk</a>&gt; added the comment:<br>
<br>
</div>Bill,<br>
<br>
I was looking at this patch again, and I&#39;m not sure about thread safety. The correctness of the caching depends on manager.status, which is state which is potentially shared across threads. There are no interlocks around it, so with the patch as it stands, ISTM it&#39;s possible in a multi-threaded application to get stale information. Has your patch been used in multi-threaded applications?<br>

<div><div></div><div class="h5"><br>
----------<br>
<br>
_______________________________________<br>
Python tracker &lt;<a href="mailto:report at bugs.python.org">report at bugs.python.org</a>&gt;<br>
&lt;<a href="http://bugs.python.org/issue11369" target="_blank">http://bugs.python.org/issue11369</a>&gt;<br>
_______________________________________<br>
</div></div></blockquote></div><br>


More information about the Python-bugs-list mailing list