ChiliProject is not maintained anymore. Please be advised that there will be no more updates.
We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.
Exception raised when changes YAML is invalid (Bug #737)
Description
If the Journal#changes serialized column becomes corrupted with invalid YAML a Internal Server Error is raised. Here is the exception:
ActiveRecord::SerializationTypeMismatch: changes was supposed to be a Hash, but was a String
This affects views in the app and the migrations that update to acts_as_journalized.
its is not entirely unexpected that the app would break if the YAML in the Journal#changes column is corrupted. However, it does not degrade nicely and makes the application unusable in any area where the corrupted object is accessed. Plus it was hard to find as the only part of the error shown in the logs was "changes was supposed to be a Hash, but was a String". I had to iterate over every Issue in my system and call Issue#event_type to find the corrupted ones. Fixing the YAML in the database was the workaround fix.
History
Updated by Felix Schäfer at 2011-11-28 04:50 pm
Do you still have the broken yaml? Inspecting it might yield a clue as to where it got corrupted.
Regarding the graceful degradation, I don't know how easy that would be to achieve, as serialization and deserialization is handled by Rails itself. Care to give us some more information about your setup as described in Contribute? Thanks!
Updated by Felix Schäfer at 2011-11-28 04:50 pm
- Category set to Journals / History
Updated by Felix Schäfer at 2011-11-28 04:51 pm
Also, was that a clean or an upgraded install? From which previous version?
Updated by Peer Allan at 2011-11-28 05:19 pm
This was an upgrade/transition from Redmine 1.2 to Chiliproject 2.3. The journal entry in Chiliproject was for creation of the issue. YAML example is below
--- start_date: - - 2010-07-19 estimated_hours: - - closed_date: - - priority_id: - - 3 created_on: - - 2010-07-19 02:28:11 +01:00 project_id: - 0 - 60 is_private: - false - false root_id: - - 16551 lock_version: - 0 - 0 lft: - - 1 fixed_version_id: - - updated_on: - - 2010-07-19 02:28:11 +01:00 subject: - "" - "this is the subject " done_ratio: - 0 - 100 assigned_to_id: - - 186 tracker_id: - 0 - 4 category_id: - - parent_id: - - due_date: - - status_id: - 1 - 5 description: - "" - | This is the description and what it looked like, but I had to remove confidential information, I hope this replacement text still helps author_id: - 0 - 186 rgt: - - 2
Updated by Felix Schäfer at 2011-12-01 04:53 pm
Which version of ruby were you on when you migrated to ChiliProject 2.x, and which version are you using now?
- Status changed from Open to Needs more information
Updated by Peer Allan at 2011-12-01 05:06 pm
$ ruby -v ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2011.03
Updated by Felix Schäfer at 2011-12-01 05:21 pm
Peer, the description is at fault, at least in the part you've pasted. The 2nd field of the description (with the text in it) has 2 leading spaces, which is not yaml-conform (it should be quoted so a yaml parser doesn't mistake the leading spaces for indentation). Seeing it is the same library doing the exporting and parsing, I can't say how that came to be, in a ChiliProject console the yaml dumper dumps the string correctly.