Problem accessing specific pages when logged-in

Hello Discourse community!

We are running Discourse version 2.4.5 through Docker on a Debian VM. The following error message:

NoMethodError (undefined method automatic_membership_retroactive' for #<Group:0x00007fb84804bac0>) /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activemodel-6.0.1/lib/active_model/attribute_methods.rb:431:in method_missing’

… is displayed in the Discourse logs when trying to access some pages as a logged-in (and admin-level in my case) user:

The problem is not only manifesting on my own profile page (/u/mathieugp), it is all profiles that produce the error in the Discourse error log and show a 500 type error on the client side. Sometimes it is a 404 error log when loading certain other pages (sub-pages as far as I can tell) like this one:

  • /u/mathieugp/summary

I can view my own profile (and other profiles) when not logged in. Obviously I cannot view anything useful of groups administration when not logged-in, but no unusual error is being displayed either.

The full backtrace from the Discourse log:

> activemodel-6.0.1/lib/active_model/attribute_methods.rb:431:in `method_missing'
> active_model_serializers-0.8.4/lib/active_model/serializer.rb:99:in `block in attribute'
> (eval):12:in `_fast_attributes'
> active_model_serializers-0.8.4/lib/active_model/serializer.rb:468:in `rescue in attributes'
> active_model_serializers-0.8.4/lib/active_model/serializer.rb:455: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/array_serializer.rb:89:in `block in _serializable_array'
> active_model_serializers-0.8.4/lib/active_model/array_serializer.rb:79:in `map'
> active_model_serializers-0.8.4/lib/active_model/array_serializer.rb:79:in `_serializable_array'
> active_model_serializers-0.8.4/lib/active_model/array_serializer.rb:73:in `serializable_array'
> active_model_serializers-0.8.4/lib/active_model/array_serializer.rb:53:in `as_json'
> /var/www/discourse/app/controllers/application_controller.rb:427:in `serialize_data'
> /var/www/discourse/app/controllers/groups_controller.rb:91:in `index'
> actionpack-6.0.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
> actionpack-6.0.1/lib/abstract_controller/base.rb:196:in `process_action'
> actionpack-6.0.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
> actionpack-6.0.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
> activesupport-6.0.1/lib/active_support/callbacks.rb:135:in `run_callbacks'
> actionpack-6.0.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
> actionpack-6.0.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
> actionpack-6.0.1/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
> activesupport-6.0.1/lib/active_support/notifications.rb:180:in `block in instrument'
> activesupport-6.0.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
> activesupport-6.0.1/lib/active_support/notifications.rb:180:in `instrument'
> actionpack-6.0.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
> actionpack-6.0.1/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
> activerecord-6.0.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
> actionpack-6.0.1/lib/abstract_controller/base.rb:136:in `process'
> actionview-6.0.1/lib/action_view/rendering.rb:39:in `process'
> rack-mini-profiler-1.1.6/lib/mini_profiler/profiling_methods.rb:78:in `block in profile_method'
> actionpack-6.0.1/lib/action_controller/metal.rb:191:in `dispatch'
> actionpack-6.0.1/lib/action_controller/metal.rb:252:in `dispatch'
> actionpack-6.0.1/lib/action_dispatch/routing/route_set.rb:51:in `dispatch'
> actionpack-6.0.1/lib/action_dispatch/routing/route_set.rb:33:in `serve'
> actionpack-6.0.1/lib/action_dispatch/journey/router.rb:49:in `block in serve'
> actionpack-6.0.1/lib/action_dispatch/journey/router.rb:32:in `each'
> actionpack-6.0.1/lib/action_dispatch/journey/router.rb:32:in `serve'
> actionpack-6.0.1/lib/action_dispatch/routing/route_set.rb:837:in `call'
> /var/www/discourse/lib/middleware/omniauth_bypass_middleware.rb:68:in `call'
> rack-2.0.8/lib/rack/tempfile_reaper.rb:15:in `call'
> rack-2.0.8/lib/rack/conditional_get.rb:25:in `call'
> rack-2.0.8/lib/rack/head.rb:12:in `call'
> /var/www/discourse/lib/content_security_policy/middleware.rb:12:in `call'
> /var/www/discourse/lib/middleware/anonymous_cache.rb:318:in `call'
> rack-2.0.8/lib/rack/session/abstract/id.rb:259:in `context'
> rack-2.0.8/lib/rack/session/abstract/id.rb:253:in `call'
> actionpack-6.0.1/lib/action_dispatch/middleware/cookies.rb:648:in `call'
> actionpack-6.0.1/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
> activesupport-6.0.1/lib/active_support/callbacks.rb:101:in `run_callbacks'
> actionpack-6.0.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
> actionpack-6.0.1/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
> actionpack-6.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
> actionpack-6.0.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
> logster-2.6.3/lib/logster/middleware/reporter.rb:43:in `call'
> railties-6.0.1/lib/rails/rack/logger.rb:38:in `call_app'
> railties-6.0.1/lib/rails/rack/logger.rb:28:in `call'
> /var/www/discourse/config/initializers/100-quiet_logger.rb:18:in `call'
> /var/www/discourse/config/initializers/100-silence_logger.rb:31:in `call'
> actionpack-6.0.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
> actionpack-6.0.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
> /var/www/discourse/lib/middleware/enforce_hostname.rb:17:in `call'
> rack-2.0.8/lib/rack/method_override.rb:22:in `call'
> actionpack-6.0.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
> rack-2.0.8/lib/rack/sendfile.rb:111:in `call'
> actionpack-6.0.1/lib/action_dispatch/middleware/host_authorization.rb:77:in `call'
> rack-mini-profiler-1.1.6/lib/mini_profiler/profiler.rb:184:in `call'
> message_bus-2.2.3/lib/message_bus/rack/middleware.rb:57:in `call'
> /var/www/discourse/lib/middleware/request_tracker.rb:181:in `call'
> railties-6.0.1/lib/rails/engine.rb:526:in `call'
> railties-6.0.1/lib/rails/railtie.rb:190:in `public_send'
> railties-6.0.1/lib/rails/railtie.rb:190:in `method_missing'
> rack-2.0.8/lib/rack/urlmap.rb:68:in `block in call'
> rack-2.0.8/lib/rack/urlmap.rb:53:in `each'
> rack-2.0.8/lib/rack/urlmap.rb:53:in `call'
> unicorn-5.5.3/lib/unicorn/http_server.rb:605:in `process_client'
> unicorn-5.5.3/lib/unicorn/http_server.rb:700:in `worker_loop'
> unicorn-5.5.3/lib/unicorn/http_server.rb:548:in `spawn_missing_workers'
> unicorn-5.5.3/lib/unicorn/http_server.rb:144:in `start'
> unicorn-5.5.3/bin/unicorn:128:in `<top (required)>'
> /var/www/discourse/vendor/bundle/ruby/2.6.0/bin/unicorn:23:in `load'
> /var/www/discourse/vendor/bundle/ruby/2.6.0/bin/unicorn:23:in `<main>'

Let me know what other informations might be useful to better understand the bug.

I probably should mention some prior problems we encountered with access to certain pages on our instance of Discourse. For a while, I could not even access the administration area at all. This problem seemed to have disappeared completely after running the following command:

# ./launcher rebuild app

I could again access the administration area, but I failed to notice my inability to manage groups. I only saw it several weeks later when I needed to add some user to a group. I am not sure about viewing profiles unfortunately: it seems like I could not have missed something so big, but maybe I was not logged-in at some point and I assumed everything was fine when it was not? That or the problem displaying profiles was not there and appeared only later. (Sorry for the vague of those last statements: I cannot recall for sure and there is not trail for me to follow either!)

Wait are you on the “stable” branch here? Can you move to beta, that backtrace is either from stable or some older version of Discourse.

Looks to me like you instance is part migrated?

@sam Yes we are on the stable release channel as far as I know. Am I understanding correctly that you suggest we upgrade from stable to the latest beta to try to workaround the problem? Would it suffice to move back to the tests-passed channel?

Moving to tests-passed would be fine as well, but keep in mind you can only move back to beta or stable the day we do a release of beta or stable.

1 Like

Migrating from 2.4.5 to 2.5.0 seems to have fixed whatever the problem was. Thank you very much Sam! :slight_smile:

1 Like