Jobs::DownloadAvatarFromUrl times out


we just started using avatar_url via discourseconnect. Override avatar is enabled and force avatar update is set to true on the SSO side.

Login works as intended but the avatars won’t get synced. Enabling verbose for SSO login shows all the correct params but we always get an error from Jobs::DownloadAvatarFromUrl that says “Job exception: execution expired”.

I don’t know what could be causing this. I tested it on a local Discourse instance and it worked without a flaw (i.e. the avatars get downloaded without an issue).

Any ideas how to fix that or what’s causing that?

Current Discourse version: 2.8.0.beta1


hostname	docker-app
process_id	127
application_version	96fd202d9cdac98196abd952c53f583b4af9d8f2
current_db	default
current_hostname	*correct hostname*
job	Jobs::DownloadAvatarFromUrl
problem_db	default
time	10:58 am
url	*correct url*
user_id	*correct user id*
override_gravatar	true
current_site_id	default


/usr/local/lib/ruby/2.7.0/net/http.rb:960:in `initialize'
/usr/local/lib/ruby/2.7.0/net/http.rb:960:in `open'
/usr/local/lib/ruby/2.7.0/net/http.rb:960:in `block in connect'
/usr/local/lib/ruby/2.7.0/timeout.rb:105:in `timeout'
/usr/local/lib/ruby/2.7.0/net/http.rb:958:in `connect'
/usr/local/lib/ruby/2.7.0/net/http.rb:943:in `do_start'
/usr/local/lib/ruby/2.7.0/net/http.rb:932:in `start'
/usr/local/lib/ruby/2.7.0/net/http.rb:606:in `start'
/var/www/discourse/lib/final_destination.rb:443:in `safe_session'
/var/www/discourse/lib/final_destination.rb:394:in `safe_get'
/var/www/discourse/lib/final_destination.rb:133:in `get'
/var/www/discourse/lib/file_helper.rb:56:in `download'
/var/www/discourse/app/models/user_avatar.rb:98:in `import_url_for_user'
/var/www/discourse/app/jobs/regular/download_avatar_from_url.rb:18:in `execute'
/var/www/discourse/app/jobs/base.rb:232:in `block (2 levels) in perform'
rails_multisite-3.0.0/lib/rails_multisite/connection_management.rb:80:in `with_connection'
/var/www/discourse/app/jobs/base.rb:221:in `block in perform'
/var/www/discourse/app/jobs/base.rb:217:in `each'
/var/www/discourse/app/jobs/base.rb:217:in `perform'
sidekiq-6.2.1/lib/sidekiq/processor.rb:196:in `execute_job'
sidekiq-6.2.1/lib/sidekiq/processor.rb:164:in `block (2 levels) in process'
sidekiq-6.2.1/lib/sidekiq/middleware/chain.rb:138:in `block in invoke'
/var/www/discourse/lib/sidekiq/pausable.rb:138:in `call'
sidekiq-6.2.1/lib/sidekiq/middleware/chain.rb:140:in `block in invoke'
sidekiq-6.2.1/lib/sidekiq/middleware/chain.rb:143:in `invoke'
sidekiq-6.2.1/lib/sidekiq/processor.rb:163:in `block in process'
sidekiq-6.2.1/lib/sidekiq/processor.rb:136:in `block (6 levels) in dispatch'
sidekiq-6.2.1/lib/sidekiq/job_retry.rb:112:in `local'
sidekiq-6.2.1/lib/sidekiq/processor.rb:135:in `block (5 levels) in dispatch'
sidekiq-6.2.1/lib/sidekiq.rb:38:in `block in <module:Sidekiq>'
sidekiq-6.2.1/lib/sidekiq/processor.rb:131:in `block (4 levels) in dispatch'
sidekiq-6.2.1/lib/sidekiq/processor.rb:257:in `stats'
sidekiq-6.2.1/lib/sidekiq/processor.rb:126:in `block (3 levels) in dispatch'
sidekiq-6.2.1/lib/sidekiq/job_logger.rb:13:in `call'
sidekiq-6.2.1/lib/sidekiq/processor.rb:125:in `block (2 levels) in dispatch'
sidekiq-6.2.1/lib/sidekiq/job_retry.rb:79:in `global'
sidekiq-6.2.1/lib/sidekiq/processor.rb:124:in `block in dispatch'
sidekiq-6.2.1/lib/sidekiq/logger.rb:11:in `with'
sidekiq-6.2.1/lib/sidekiq/job_logger.rb:33:in `prepare'
sidekiq-6.2.1/lib/sidekiq/processor.rb:123:in `dispatch'
sidekiq-6.2.1/lib/sidekiq/processor.rb:162:in `process'
sidekiq-6.2.1/lib/sidekiq/processor.rb:78:in `process_one'
sidekiq-6.2.1/lib/sidekiq/processor.rb:68:in `run'
sidekiq-6.2.1/lib/sidekiq/util.rb:43:in `watchdog'
sidekiq-6.2.1/lib/sidekiq/util.rb:52:in `block in safe_thread'

Edit: There’s enough RAM and disk space. I already checked that.

Edit2: It might in fact be a memory issue. I didn’t see the difference between memory on the host machine and the allocated memory for the Discourse. We currently have only 512MB set in our app.yml, though I still have to verify that that’s the cause.

1 Like

Sorry for the late update.

I just got around testing with 1024MB and 2048MB of memory allocated but the result is still the same. Any more suggestions would be highly appreciated!

Edit: So after going through the logs again and again, I checked the code for the job and saw that this is not intented to be retried. Naturally, this is exactly what I did. I edited the file and found in Sidekiq that my issue is actually related to network related things.
The retry job gives me

Jobs::HandledExceptionWrapper: Wrapped Net::OpenTimeout: execution expired

as an error I can actually work with.

The takeaway for anyone in the future is: If url).read in the rails console does not work, it’s likely a ruby-network issue instead of an Discourse issue. I had the idea from stackoverflow

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.