I’m really tired and can’t see anything wrong and I’m not sure how to test that the swap file is set up, it should be though! As I say, everything was working fine and nothing was changed except deleting the emoji.
OK, a bit more awake this morning, here’s the log where the 500 errors started and as I said, it was literally after I deleted a custom emoji, of course there still could be some other problem somewhere that is causing this, but now I am pretty convinced this was the trigger event:
Started GET "/admin/customize/emojis.json?_=1493157113083" for 213.205.253.56 at 2017-04-25 21:52:21 +0000
Processing by Admin::EmojisController#index as JSON
Parameters: {"_"=>"1493157113083"}
Completed 200 OK in 2ms (Views: 0.1ms | ActiveRecord: 0.0ms)
Started DELETE "/admin/customize/emojis/ord_88" for 213.205.253.56 at 2017-04-25 21:52:25 +0000
Processing by Admin::EmojisController#destroy as */*
Parameters: {"id"=>"ord_88"}
Completed 200 OK in 80ms (Views: 4.7ms | ActiveRecord: 13.5ms)
Started GET "/latest.json?order=default&_=1493157113084" for 213.205.253.56 at 2017-04-25 21:52:28 +0000
Processing by ListController#latest as JSON
Parameters: {"order"=>"default", "_"=>"1493157113084"}
Completed 200 OK in 341ms (Views: 0.6ms | ActiveRecord: 45.9ms)
Started GET "/" for 213.205.253.56 at 2017-04-25 21:52:30 +0000
Processing by ListController#latest as HTML
Completed 500 Internal Server Error in 55ms (ActiveRecord: 15.1ms)
NoMethodError (undefined method `url' for nil:NilClass)
/var/www/discourse/app/models/emoji.rb:98:in `block (2 levels) in load_custom'
Started GET "/" for <myip> at 2017-04-25 21:52:34 +0000
Processing by ListController#latest as HTML
Completed 500 Internal Server Error in 85ms (ActiveRecord: 14.8ms)
NoMethodError (undefined method `url' for nil:NilClass)
/var/www/discourse/app/models/emoji.rb:98:in `block (2 levels) in load_custom'
From this moment onwards there have been problems and the site is unusable
Does anyone know what has happened here and how to fix it please?
I’ve have a look through the code path again to see if I missed something. You shouldn’t have to go through all the trouble just to remove a custom emoji.
I can’t really tell what the root cause is here but I’ve added preventive measures to not blow up the whole site just because one custom emoji is broken.