Hi Anuj

For the test, make sure run it using jruby. It fails every single
time.

~/code/arel:<master>? % rvm use jruby@arel
~/code/arel:<master>? % rake
...
Finished tests in 1.045000s, 413.3971 tests/s, 537.7990 assertions/s.

  1) Failure:
test_0006_should_be_threadsafe_on_sql_generation(select manager) [./
test/test_select_manager.rb:954]:
Expected "SELECT \"users\".\"id\" FROM \"users\" WHERE \"users\".\"id
\" = 1 AND \"users\".\"name\" = 'foo'", not "SELECT \"users\".\"id\"
FROM \"users\" WHERE \"users\".\"id\" = 1 AND \"users\".\"name\" = 0".


-- wpc


On May 5, 6:39 am, Ketan Padegaonkar <[email protected]>
wrote:
> Hi Anuj,
>
> One of my colleagues put some tests 
> here:https://github.com/wpc/arel/commit/1b51481487466510189936d9613ceba8a3....
> 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/52dc69f5bebebb75b7b3d7bd42e839f2...)
> >> 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