Auto-close Topic – indefinite "Internal Server Error"

Previous topic name: “This topic will close a few seconds after the last reply.”

After updating to Discourse 2.5.0.beta2 +207, many of the categories with a topic timer suddenly changed from their default setting to "a few seconds".


Context: Several of our categories have a “close topic x time after the last reply”. 672 hours, for most of them. These are individual category settings.

image

Upon updating, this has resulted in it visually showing “a few seconds” as the remaining time left before closing. But, it never closes – and anyone trying to reply will get an “Internal Server Error” pop-up message. In the /logs:

NoMethodError (undefined method `>' for nil:NilClass) /var/www/discourse/lib/post_creator.rb:473:in `update_topic_auto_close'
Full log entry
/var/www/discourse/lib/post_creator.rb:473:in `update_topic_auto_close'

/var/www/discourse/lib/post_creator.rb:183:in `block in create'

/var/www/discourse/lib/post_creator.rb:366:in `block (2 levels) in transaction'

activerecord-6.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `block in transaction'

activerecord-6.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'

/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'

activerecord-6.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'

activerecord-6.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `transaction'

activerecord-6.0.1/lib/active_record/transactions.rb:212:in `transaction'

/var/www/discourse/lib/post_creator.rb:365:in `block in transaction'

/var/www/discourse/lib/distributed_mutex.rb:33:in `block in synchronize'

/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'

/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'

/var/www/discourse/lib/distributed_mutex.rb:14:in `synchronize'

/var/www/discourse/lib/post_creator.rb:364:in `transaction'

/var/www/discourse/lib/post_creator.rb:174:in `create'

/var/www/discourse/lib/new_post_manager.rb:271:in `perform_create_post'

/var/www/discourse/lib/new_post_manager.rb:209:in `perform'

/var/www/discourse/app/controllers/posts_controller.rb:179:in `create'

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-2.0.1/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:38: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.7.1/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:22: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-2.0.1/lib/mini_profiler/profiler.rb:200: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>'

I’m sure there should be something else tied to causing this issue, but I haven’t been able to pinpoint it.


In addition to reporting this as a bug, I’m also curious as to what the most efficient way of fixing these posts would be? I can manually edit the topic timer on each post to resolve it, but that would involve manually editing hundreds of posts.

Closing and reopening topics en masse also helps to resolve the issue, but still requires reapplying the topic timer. It also means manually reopening topics – as you can only close en masse.

Ideally, there’d be a setting to apply the “topic timer” category setting recursively, as even outside of our bug-related issue, this would surely be useful to those wanting to use that specific feature. I would imagine that it’d have been a method for resolving this issue though.

Any advice on a course of action to more efficiently resolve the issue would be appreciated.

1 Like

This is now fixed by the commit below

https://github.com/discourse/discourse/commit/c4bc734b11ba310086b1a7ab28f0d57e6a6030d8

5 Likes