Problem with post revisions after updating to 2.8.6 stable or 2.9.0.beta7

We are noticing some posts where the previous revisions are not showing:

(there’s no text at all and notice the NaN on a post with 3 versions)

On the console I’m seeing a 500 error on /posts/X/revisions/latest.json .

On /logs I’m seeing the error below. This is on 2.8.6. We only noticed this after updating yesterday from 2.8.4, but I can’t guarantee it is related as we noticed this only in a couple of posts. I have tried rebuilt the container, but made no difference.

Psych::DisallowedClass (Tried to load unspecified class: Symbol)
app/serializers/post_revision_serializer.rb:233:in `block in all_revisions'
app/serializers/post_revision_serializer.rb:228:in `each'
app/serializers/post_revision_serializer.rb:228:in `all_revisions'
app/serializers/post_revision_serializer.rb:187:in `revisions'
app/serializers/post_revision_serializer.rb:254:in `previous'
app/serializers/post_revision_serializer.rb:50:in `previous_hidden'
(eval):5:in `_fast_attributes'
app/controllers/application_controller.rb:510:in `render_json_dump'
app/controllers/posts_controller.rb:425:in `latest_revision'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:361:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:198:in `call'

Backtrace:

/usr/local/lib/ruby/2.7.0/psych/class_loader.rb:97:in `find'
/usr/local/lib/ruby/2.7.0/psych/class_loader.rb:28:in `load'
/usr/local/lib/ruby/2.7.0/psych/class_loader.rb:39:in `block (2 levels) in <class:ClassLoader>'
/usr/local/lib/ruby/2.7.0/psych/class_loader.rb:32:in `symbolize'
/usr/local/lib/ruby/2.7.0/psych/class_loader.rb:82:in `symbolize'
/usr/local/lib/ruby/2.7.0/psych/scalar_scanner.rb:74:in `tokenize'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:60:in `deserialize'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:123:in `visit_Psych_Nodes_Scalar'
/usr/local/lib/ruby/2.7.0/psych/visitors/visitor.rb:16:in `visit'
/usr/local/lib/ruby/2.7.0/psych/visitors/visitor.rb:6:in `accept'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:32:in `accept'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:339:in `block in revive_hash'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:338:in `each'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:338:in `each_slice'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:338:in `revive_hash'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:162:in `visit_Psych_Nodes_Mapping'
/usr/local/lib/ruby/2.7.0/psych/visitors/visitor.rb:16:in `visit'
/usr/local/lib/ruby/2.7.0/psych/visitors/visitor.rb:6:in `accept'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:32:in `accept'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:332:in `block in register_empty'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:332:in `each'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:332:in `register_empty'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Sequence'
/usr/local/lib/ruby/2.7.0/psych/visitors/visitor.rb:16:in `visit'
/usr/local/lib/ruby/2.7.0/psych/visitors/visitor.rb:6:in `accept'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:32:in `accept'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:340:in `block in revive_hash'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:338:in `each'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:338:in `each_slice'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:338:in `revive_hash'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:162:in `visit_Psych_Nodes_Mapping'
/usr/local/lib/ruby/2.7.0/psych/visitors/visitor.rb:16:in `visit'
/usr/local/lib/ruby/2.7.0/psych/visitors/visitor.rb:6:in `accept'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:32:in `accept'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:313:in `visit_Psych_Nodes_Document'
/usr/local/lib/ruby/2.7.0/psych/visitors/visitor.rb:16:in `visit'
/usr/local/lib/ruby/2.7.0/psych/visitors/visitor.rb:6:in `accept'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:32:in `accept'
/usr/local/lib/ruby/2.7.0/psych.rb:360:in `safe_load'
activerecord (6.1.6.1) lib/active_record/coders/yaml_column.rb:50:in `yaml_load'
activerecord (6.1.6.1) lib/active_record/coders/yaml_column.rb:26:in `load'
activerecord (6.1.6.1) lib/active_record/type/serialized.rb:22:in `deserialize'
activemodel (6.1.6.1) lib/active_model/type/helpers/mutable.rb:8:in `cast'
activemodel (6.1.6.1) lib/active_model/attribute.rb:175:in `type_cast'
activemodel (6.1.6.1) lib/active_model/attribute.rb:43:in `value'
activemodel (6.1.6.1) lib/active_model/attribute_set.rb:42:in `fetch_value'
activerecord (6.1.6.1) lib/active_record/attribute_methods/read.rb:36:in `_read_attribute'
activemodel (6.1.6.1) lib/active_model/attribute_methods.rb:254:in `modifications'
app/serializers/post_revision_serializer.rb:233:in `block in all_revisions'
app/serializers/post_revision_serializer.rb:228:in `each'
app/serializers/post_revision_serializer.rb:228:in `all_revisions'
app/serializers/post_revision_serializer.rb:187:in `revisions'
app/serializers/post_revision_serializer.rb:254:in `previous'
app/serializers/post_revision_serializer.rb:50:in `previous_hidden'
(eval):5:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:456:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:347:in `as_json'
activesupport (6.1.6.1) lib/active_support/json/encoding.rb:22:in `encode'
activesupport (6.1.6.1) lib/active_support/json/encoding.rb:22:in `encode'
activesupport (6.1.6.1) lib/active_support/core_ext/object/json.rb:43:in `to_json'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:331:in `to_json'
multi_json (1.15.0) lib/multi_json/adapters/oj.rb:56:in `dump'
multi_json (1.15.0) lib/multi_json/adapters/oj.rb:56:in `dump'
multi_json (1.15.0) lib/multi_json/adapter.rb:25:in `dump'
multi_json (1.15.0) lib/multi_json.rb:139:in `dump'
app/controllers/application_controller.rb:510:in `render_json_dump'
app/controllers/posts_controller.rb:425:in `latest_revision'
actionpack (6.1.6.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.1.6.1) lib/abstract_controller/base.rb:228:in `process_action'
actionpack (6.1.6.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.1.6.1) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.1.6.1) lib/active_support/callbacks.rb:117:in `block in run_callbacks'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
i18n (1.8.11) lib/i18n.rb:314:in `with_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
activesupport (6.1.6.1) lib/active_support/callbacks.rb:126:in `block in run_callbacks'
activesupport (6.1.6.1) lib/active_support/callbacks.rb:137:in `run_callbacks'
actionpack (6.1.6.1) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.1.6.1) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.1.6.1) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (6.1.6.1) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.6.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.6.1) lib/active_support/notifications.rb:203:in `instrument'
actionpack (6.1.6.1) lib/action_controller/metal/instrumentation.rb:33:in `process_action'
actionpack (6.1.6.1) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
activerecord (6.1.6.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.1.6.1) lib/abstract_controller/base.rb:165:in `process'
actionview (6.1.6.1) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (2.3.3) lib/mini_profiler/profiling_methods.rb:111:in `block in profile_method'
actionpack (6.1.6.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.1.6.1) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.1.6.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.1.6.1) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.1.6.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (6.1.6.1) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.1.6.1) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.1.6.1) lib/action_dispatch/routing/route_set.rb:842:in `call'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.3) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.3) lib/rack/head.rb:12:in `call'
actionpack (6.1.6.1) lib/action_dispatch/http/permissions_policy.rb:22:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:361:in `call'
rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.1.6.1) lib/action_dispatch/middleware/cookies.rb:689:in `call'
actionpack (6.1.6.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.1.6.1) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (6.1.6.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.1.6.1) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack (6.1.6.1) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack (6.1.6.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
logster (2.10.1) lib/logster/middleware/reporter.rb:43:in `call'
railties
2 Likes

Is this a public site? Are you able to share a link to the affected posts? (via PM is fine if you prefer)

3 Likes

Sent via PM. Happy to send to others if needed.

2 Likes

I’ve had a quick look at the links you shared and it seems that the posts with missing edit revisions are the ones that also have the dates in the topic header. Do you have a theme component that adds those?

4 Likes

Unsure if you mean the topic title or something else. The topic tiles, despite their look, are manually added. Although, yes, both posts with problem seem to happen within a common parent category which is where people organize meetings.

We do run the paviliondev/discourse-events plugin and topics on this category do have an associated event on the first post (which is where this problem is happening). However, using the safe-mode to disable the plugin didn’t seem to make the revisions work again.

Anything else I could try?

3 Likes

I think this must be related to SECURITY: Bump Rails to 6.1.6.1 (stable) (#17470) · discourse/discourse@bb287c6 · GitHub. I’m looking through some of our own sites right now and it seems like we have a few similar error logs. Will get it fixed up and update here when it’s fixed :eyes:

6 Likes

This should be fixed by FIX: Allow Time objects to be deserialized in PostRevision (#17501) · discourse/discourse@7d9b98a · GitHub

and on the stable branch FIX: Allow Time objects to be deserialized in PostRevision (stable) (… · discourse/discourse@5d2ecce · GitHub

To update a standard install, visit /admin/upgrade

7 Likes

I am still getting this issue, after upgrading.


It’s more occasional, but it still happens every now and then.

3 Likes

Thank you for the quick work on this. But I fear it hasn’t fixed it for us. The two posts I mentioned still behave the same way, with no visible versions. Tried both /admin/upgrade and rebuilding it.

2 Likes

Sorry about that! This fix did help with the similar errors we were seeing on our hosting, so there must be something extra at play on your site. Most likely plugin/import related.

Please can you visit /logs and look for any errors like

Psych::DisallowedClass (Tried to load unspecified class: Time)

The “Time” version is the only one we were seeing, and should now be resolved. What other ‘unspecified class’ errors do you see in your logs?

1 Like

Ah, so maybe not the the same problem then.

All the Psych::DisallowedClass errors we have been seeing are about class unspecified class: Symbol, as per backtrace posted earlier.

I tried disabling the events (from paviliondev/discourse-events plugin) on that particular category, but that alone didn’t seem to make a difference.

Does the error above give any hint before I go the route of trying to disable the plugin forum wide (which will require rebuilds)?

2 Likes

Unfortunately I don’t think disabling the plugin will make any difference. The problematic data is already stored in the database, so it’s there to stay. I think we can safely add Symbol to the list of allowed classes. I’ll do that :eyes:

Edit: to be clear, this isn’t really the plugin’s fault. Previously, any data type was allowed to be stored in the PostRevision. The Rails security issue means we’ve had to suddenly change the behaviour and limit the allowed data types.

3 Likes

Please can you try updating again @mentalstring - I just pushed FIX: Allow Symbol objects to be deserialized in PostRevision (stable)… · discourse/discourse@f0ef186 · GitHub

3 Likes

That was it — it’s working as expected now! :+1:

Thank you for looking into this so quickly.

3 Likes

Hey, this still doesn’t work after the update.

@Pixlz please can you follow these steps and let us know what you find:


I only see this stuff.

Hmm ok, looks like you have errors for User and Group. Can you share a list of plugins which are installed on the site?

1 Like

Plugins:
Discourse-Akismet
Discourse Apple Login
Discourse BCC
Discourse Cakeday
Discourse Calendar
Discourse Chat
Discourse Custom Wizard
Discourse follow
Discourse Gamification
Discourse Mate
Discourse Microsoft login
Discourse ImgFlip
Discourse Promethehus
Discourse Ratings
Discourse Solved
Discourse Spoiler
Discourse Steam Login
Discourse Tickets
Discourse Userr Network
Discourse User Notes
Discourse Voting
Discourse QA
Discourse Who’s online
Discourse Yearly Review
Discourse Manager
Styleguide
I can get components if you want

1 Like

Aka, we have pretty much every plugin that’s functional :rofl:

1 Like