Patch #16319

Random crash when using custom fields

Added by Felix Schäfer over 4 years ago. Updated over 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Code cleanup/refactoring
Target version:2.5.1

Description

We (Planio) have seen several random crashes when using custom fields and have narrowed the problem to the usage of super to access attribute setters and getters in ActiveRecord models. According the the ActiveRecord docs, the preferred way to set and get a value from within a custom setter and getter is to use read_attribute and write_attribute.

16319.patch Magnifier (884 Bytes) Felix Schäfer, 2014-03-11 15:56

fix-crash.diff Magnifier (689 Bytes) Ebrahim Mohammadi, 2014-03-13 04:40

Associated revisions

Revision 12968
Added by Jean-Philippe Lang over 4 years ago

Use #read/#write_attribute instead of #super when overwriting default accessors (#16319).

Patch by Felix Schäfer.

History

#1 Updated by Felix Schäfer over 4 years ago

The attached patch changes the super calls in CustomField#possible_values and CustomField#possible_values= to read_attribute and write_attribute.

#2 Updated by Etienne Massip over 4 years ago

  • Target version set to Candidate for next minor release

#3 Updated by Ebrahim Mohammadi over 4 years ago

I experience some random crashed too. Isn't your problem the same as my problem which I worked around using the attached patch?

#4 Updated by Jean-Philippe Lang over 4 years ago

  • Category set to Code cleanup/refactoring
  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version changed from Candidate for next minor release to 2.5.1

Patch applied in r12968, thanks.

#5 Updated by Jean-Philippe Lang over 4 years ago

  • Status changed from Resolved to Closed

Merged.

Also available in: Atom PDF