#732 ✓resolved

DataMapper::Adapters::AbstractAdapter::Transaction#transaction not thread safe

Reported by zeijeigo | December 31st, 2008 @ 11:36 AM | in 0.10.0

dm-core/adapters/abstract_adapter.rb line ~196 -- delete_if is not safe.

The bug was found using a (modified to allow concurrent access to db by using a mutex) sqlite3 adapter. When saving 10k objects concurrently, a RuntimeError "Hash modified during iteration" is consistently thrown from the before mentioned line.

Synchronizing access to the @transactions hash with a mutex or similar would probably fix the problem.

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 16th, 2009 @ 03:51 AM

    • Assigned user set to “Dan Kubb (dkubb)”
    • State changed from “unconfirmed” to “resolved”
    • Tag set to concurrency, dm-transactions, transactions
    • Milestone set to 0.10.0

    I believe this problem is resolved in dm-core/next. Marking this as resolved. Can you confirm this is the case on your end too?

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket