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

@darkpixlz can you confirm what version of Discourse you’re running? stable, beta or tests-passed?

I’m running the beta, 2.9.0beta7. I’m 2 commits behind, none of which would do anything to this issue.
image

1 Like

Updates list:

Discourse Akismet
Apple Auth
BBCode color
Cakeday
Calendar
Custom Wizard
Follow
Math
Microsoft Auth
Perspective API
ImgFlip
Prometheus
QA
Reactions
Solved
Spoiler
Steam Login
User notes
Voting
Who’s Online
Yearly Review
Docker manager
Styleguide

I just pushed this commit to core:

It introduces a new rake task which should help us track down this issue. We’re not seeing any errors at all on our hosting, so that suggests it’s related to a third-party plugin.

Please can someone with the issue update to the latest tests-passed, then run:

./launcher enter app
cd /var/www/discourse
bin/rake "revisions:debug_deserialization"

That should print out information about the problematic classes, and one example revision for each class. Please share the summary/example section of the output in this topic (or via PM, if you prefer not to share the example revision publicly).

Once we know exactly what’s causing the issue, that will help us build a fix. (likely to be either a database migration in the third-party plugin, or a core rake task which can cleanup any unexpected data)

6 Likes

I asked my host to run it, will update here once I get a result.

2 Likes

We are waiting on people to report back information from the rake task before proceeding here.

Let us know.

2 Likes

Yeah he never got back to me, just reminded him.

Hi guys,
unfortunately I wasted time in this thread…

So I just updated to latest build and still have the issue as well.

I tried to run this but guess my setup does not allow me to help here:

I have it running inside docker / postgres.
Is there anything else I can do to help you with this?

Those are my used plugins

You need the environment set … try rake instead of bin/rake

Ah, if you did ./launcher enter app, it’ll make you root. It seems like you’ll need to switch to the discourse user to get Database access. This should do it:

sudo -EH -u discourse bin/rake "revisions:debug_deserialization"

The kind of output we’re looking for is

Checking 5 PostRevision records in batches of 1000... this may take some time...

Done

---- Summary ----
Checked records: 5

---- Examples ----

(although obviously, if there are issues then the “Examples” section will not be empty)

2 Likes

This was out output;

sudo -EH -u discourse bin/rake "revisions:debug_deserialization"

Checking 1096 PostRevision records in batches of 1000... this may take some time...

Done

---- Summary ----
Checked records: 1096

---- Examples ----
1 Like

Oh! That’s unexpected!

Are you still seeing errors when trying to view some post revisions?

BTW, is this a ‘standard install’, or is it being hosted in a multisite cluster?

Yes, it’s standard.

And n9ot really anymore, haven’t noticed for a bit, I think this may be solved.

1 Like

Ok great, thanks @darkpixlz

@B-iggy if you could try out the command in this post, I think it should solve the error you saw the first time :crossed_fingers:

2 Likes

Thanks a lot guys!
This time it ran successfully and this is the output

$w3dg @ 06:14:52 > /var/discourse: sudo ./launcher enter app
[sudo] password for w3dg:
WARNING: Docker version 17.05.0-ce deprecated, recommend upgrade to 17.06.2 or newer.
x86_64 arch detected.
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
root@W3DG-app:/var/www/discourse# cd /var/www/discourse
root@W3DG-app:/var/www/discourse# sudo -EH -u discourse bin/rake "revisions:debug_deserialization"
Checking 18451 PostRevision records in batches of 1000... this may take some time...

Done

---- Summary ----
Checked records: 18451

---- Examples ----

root@W3DG-app:/var/www/discourse#

But unfortunately my revision of that topic here is still empty. Sorry. Any other logs I can give you?

My discourse is also a standard install btw.

2 Likes

Thanks @B-iggy. That’s quite surprising - I would have expected the script to list the errors. :thinking:

Please can you try visiting /logs on your site and see whether there are any recent error logs? In particular, we’re looking for ones that start with Psych::DisallowedClass

2 Likes

Sure. I have bunch of Psych errors.
Question is: which one you need? :slight_smile:

/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/visitors/to_ruby.rb:411:in `resolve_class'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:208: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: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 (7.0.3.1) lib/active_record/coders/yaml_column.rb:50:in `yaml_load'
activerecord (7.0.3.1) lib/active_record/coders/yaml_column.rb:26:in `load'
activerecord (7.0.3.1) lib/active_record/type/serialized.rb:22:in `deserialize'
activemodel (7.0.3.1) lib/active_model/type/helpers/mutable.rb:8:in `cast'
activemodel (7.0.3.1) lib/active_model/attribute.rb:179:in `type_cast'
activemodel (7.0.3.1) lib/active_model/attribute.rb:43:in `value'
activemodel (7.0.3.1) lib/active_model/attribute_set.rb:46:in `fetch_value'
activerecord (7.0.3.1) lib/active_record/attribute_methods/read.rb:38:in `_read_attribute'
activemodel (7.0.3.1) lib/active_model/attribute_methods.rb:277: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 (7.0.3.1) lib/active_support/json/encoding.rb:22:in `encode'
activesupport (7.0.3.1) lib/active_support/json/encoding.rb:22:in `encode'
activesupport (7.0.3.1) lib/active_support/core_ext/object/json.rb:42: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:547:in `render_json_dump'
app/controllers/posts_controller.rb:428:in `latest_revision'
actionpack (7.0.3.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.3.1) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.3.1) lib/action_controller/metal/rendering.rb:53:in `process_action'
actionpack (7.0.3.1) lib/abstract_controller/callbacks.rb:234:in `block in process_action'
activesupport (7.0.3.1) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
app/controllers/application_controller.rb:415:in `block in with_resolved_locale'
i18n (1.12.0) lib/i18n.rb:322:in `with_locale'
app/controllers/application_controller.rb:415:in `with_resolved_locale'
activesupport (7.0.3.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.3.1) lib/active_support/callbacks.rb:138:in `run_callbacks'
actionpack (7.0.3.1) lib/abstract_controller/callbacks.rb:233:in `process_action'
actionpack (7.0.3.1) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (7.0.3.1) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
activesupport (7.0.3.1) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.3.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (7.0.3.1) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.0.3.1) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
actionpack (7.0.3.1) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (7.0.3.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (7.0.3.1) lib/abstract_controller/base.rb:151:in `process'
actionview (7.0.3.1) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (3.0.0) lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'
actionpack (7.0.3.1) lib/action_controller/metal.rb:188:in `dispatch'
actionpack (7.0.3.1) lib/action_controller/metal.rb:251:in `dispatch'
actionpack (7.0.3.1) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.0.3.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.0.3.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.3.1) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.3.1) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.3.1) lib/action_dispatch/routing/route_set.rb:852:in `call'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
rack (2.2.4) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.4) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.4) lib/rack/head.rb:12:in `call'
actionpack (7.0.3.1) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:366:in `call'
config/initializers/008-rack-cors.rb:25:in `call'
rack (2.2.4) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.4) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (7.0.3.1) lib/action_dispatch/middleware/cookies.rb:697:in `call'
actionpack (7.0.3.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.3.1) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.3.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.3.1) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
actionpack (7.0.3.1) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
logster (2.11.3) lib/logster/middleware/reporter.rb:43:in `call'
railties (7.0.3.1) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.3.1) lib/rails/rack/logger.rb:27:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
actionpack (7.0.3.1) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
actionpack (7.0.3.1) lib/action_dispatch/middleware/reque
Message (33 copies reported)

Psych::DisallowedClass (Tried to load unspecified class: Tag)
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:547:in `render_json_dump'
app/controllers/posts_controller.rb:428:in `latest_revision'
app/controllers/application_controller.rb:415:in `block in with_resolved_locale'
app/controllers/application_controller.rb:415: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:366:in `call'
config/initializers/008-rack-cors.rb:25: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:202: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/visitors/to_ruby.rb:411:in `resolve_class'
/usr/local/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:208: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'

Env

HTTP HOSTS: forum.empyrion-homeworld.net
Psych::DisallowedClass (Tried to load unspecified class: Tag)
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:547:in `render_json_dump'
app/controllers/posts_controller.rb:428:in `latest_revision'
app/controllers/application_controller.rb:415:in `block in with_resolved_locale'
app/controllers/application_controller.rb:415: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:368:in `call'
config/initializers/008-rack-cors.rb:25: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:202:in `call'
1 Like

Thanks, that’s helpful! Please can you try running this command and paste the output?

sudo -EH -u discourse bin/rails runner "puts PostRevisor.tracked_topic_fields.inspect"

That should help us identify which plugins are adding data to the PostRevisions :crossed_fingers:

On my local site, it returns

{:title=>#<Proc:0x0000000124b02960 /Users/david/discourse/discourse/lib/post_revisor.rb:79>, :archetype=>#<Proc:0x0000000124b028c0 /Users/david/discourse/discourse/lib/post_revisor.rb:83>, :category_id=>#<Proc:0x0000000124b020a0 /Users/david/discourse/discourse/lib/post_revisor.rb:87>, :tags=>#<Proc:0x0000000124b01880 /Users/david/discourse/discourse/lib/post_revisor.rb:103>, :featured_link=>#<Proc:0x0000000124b017e0 /Users/david/discourse/discourse/lib/post_revisor.rb:129>}
1 Like

Thanks a lot!
That is my output

root@W3DG-app:/var/www/discourse# sudo -EH -u discourse bin/rails runner "puts PostRevisor.tracked_topic_fields.inspect"
{:title=>#<Proc:0x0000563008c879c0 /var/www/discourse/lib/post_revisor.rb:79>, :archetype=>#<Proc:0x0000563008c87920 /var/www/discourse/lib/post_revisor.rb:83>, :category_id=>#<Proc:0x0000563008c87010 /var/www/discourse/lib/post_revisor.rb:87>, :tags=>#<Proc:0x0000563008c867a0 /var/www/discourse/lib/post_revisor.rb:103>, :featured_link=>#<Proc:0x0000563008c86700 /var/www/discourse/lib/post_revisor.rb:129>}
1 Like

@B-iggy and I did some digging into this via PM and managed to track down the issue. The topic in question had some old tags attached, but tagging was disabled on the site. Those two things combined led to a weird edge condition in core which was causing the error. That particular issue should be resolved by

It’s possible there are still other issues, so I’m gonna leave this topic open for a couple more weeks. Please shout if you’re still seeing problems loading revisions.

6 Likes