adzap / validates_timeliness

Date and time validation plugin for ActiveModel and Rails. Supports multiple ORMs and allows custom date/time formats.
MIT License
1.59k stars 227 forks source link

`#undefine_attribute_methods` results in recursive locking error #132

Closed codez closed 8 years ago

codez commented 8 years ago

When #undefine_attribute_methods is called (for example via #reset_column_information), a ThreadError: deadlock; recursive locking error occurs. This is because #synchronize is called in #undefine_attribute_methods and again in #undefine_timeliness_attribute_methods.

guapolo commented 8 years ago

Just stumbled upon this same error.

adzap commented 8 years ago

This is odd. Given that the gem's override of #undefine_attribute_methods calls super.tap so the lock should be released when super returns, no?

codez commented 8 years ago

I did not look at the original implementation of #undefine_attribute_methods, but the two synchronize calls happen in ValidatesTimeliness::ORM::ActiveRecord#undefine_attribute_methods and in ValidatesTimeliness::AttributeMethods#undefine_timeliness_attribute_methods, after the super call.

adzap commented 8 years ago

I can what is going now. There is a double call to synchronize, sorry. Try v4.0.1.

codez commented 8 years ago

Great, that fixed it. Thank you!