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.

Reply via email to