Logs 'Job exception: unexpected return' error

Hello :wave:

I’ve noticed this error in /logs. Which is probably related with this commit: PERF: defer loading channels (#26155) · discourse/discourse@bbb8595 · GitHub

info

Job exception: unexpected return
backtrace
/var/www/discourse/plugins/chat/app/services/chat/list_channel_messages.rb:177:in `block in update_user_last_channel'
/var/www/discourse/lib/scheduler/defer.rb:115:in `block in do_work'
rails_multisite-6.0.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
rails_multisite-6.0.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
/var/www/discourse/lib/scheduler/defer.rb:109:in `do_work'
/var/www/discourse/lib/scheduler/defer.rb:97:in `block (2 levels) in start_thread'

Few other info:

  • The thread function is disabled now on my site.

  • I’ve noticed the error shows up in /logs when I open the chat and it jump to the last visited channel. When I go back to the channel list and close the chat, the error won’t show up in /logs after open the chat.

Repro:

  1. Open chat and go to a channel
  2. Close chat
  3. Open chat again which will jump to the last visited channel

The error should appear in /logs.

Edit: Seems it sometimes happens also when I go to a channel from channel list.
Edit 2: It happens when I go to the last visited channel from channel list.

Thanks :slightly_smiling_face:

2 Likes

Good catch @Don thanks. Will be fixed in FIX: do not use return in block by jjaffeux · Pull Request #26260 · discourse/discourse · GitHub

3 Likes