Hi Anuj,

One of my colleagues put some tests here:
https://github.com/wpc/arel/commit/1b51481487466510189936d9613ceba8a32af435.
Given a high enough number on the loop that creates threads, this test
sometimes fails.

-- Ketan
studios.thoughtworks.com


On Thu, May 5, 2011 at 6:06 AM, Anuj Dutta <[email protected]> wrote:
> Hello,
>
> Have you got any tests for the same?
>
> Thanks.
>
> Anuj
>
>
> On 5 May 2011 02:32, Ketan Padegaonkar <[email protected]> wrote:
>>
>> Hey,
>>
>> We hit a bug today because Arel::Visitors::ToSql is not threadsafe.
>> Here is what is happening:
>>
>> Arel::Visitors::ENGINE_VISITORS is a cache of visitors instances.
>> These instances are not inherently threadsafe because it contains
>> state '@last_column', '@connection' that is shared between threads.
>>
>> The other variables '@pool', '@quoted_tables' and '@quoted_columns'
>> seem just fine. I'd like to propose a patch
>>
>> (https://github.com/ketan/arel/commit/52dc69f5bebebb75b7b3d7bd42e839f2db54b88a)
>> that fixes this using ruby's threadlocal for the last_column and
>> connection instance variables. Would be great if this was pulled into
>> master.
>>
>> Any other thoughts or other recommendations on approaching this?
>>
>> -- Ketan
>> studios.thoughtworks.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Core" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-core?hl=en.
>>
>
>
>
> --
> Anuj DUTTA
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-core?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to