Getting a lot of errors when users attempt to post. Any idea what could could be causing this?
Job exception: Wrapped ActiveRecord::RecordNotFound: Couldn't find Post with 'id'=86 [WHERE ("posts"."deleted_at" IS NULL)]
10 hrs ago
!
Job exception: Couldn't find Post with 'id'=98 [WHERE ("posts"."deleted_at" IS NULL)]
9 hrs ago
!
Job exception: Wrapped ActiveRecord::RecordNotFound: Couldn't find Post with 'id'=98 [WHERE ("posts"."deleted_at" IS NULL)]
9 hrs ago
!
Job exception: Couldn't find Post with 'id'=86 [WHERE ("posts"."deleted_at" IS NULL)]
6 hrs ago
!
Job exception: Wrapped ActiveRecord::RecordNotFound: Couldn't find Post with 'id'=86 [WHERE ("posts"."deleted_at" IS NULL)]
6 hrs ago
!
Job exception: Couldn't find Post with 'id'=98 [WHERE ("posts"."deleted_at" IS NULL)]
5 hrs ago
!
Job exception: Wrapped ActiveRecord::RecordNotFound: Couldn't find Post with 'id'=98 [WHERE ("posts"."deleted_at" IS NULL)]
5 hrs ago
kcoop
(Ken Cooper)
October 27, 2015, 5:41pm
2
I’m seeing this too, quite a bit.
I think this bug is in post_alert.rb (I don’t have a fork of Discourse installed, sorry, so no pull request):
def execute(args)
# maybe it was removed by the time we are making the post
if post = Post.find(args[:post_id])
# maybe the topic was deleted, so skip in that case as well
PostAlerter.post_created(post) if post.topic
end
end
It looks like the find should be a find_by_id.
1 Like
Maybe @eviltrout can you have a look?
eviltrout
(Robin Ward)
October 27, 2015, 8:04pm
4
You are seeing this when users post? Because that error is from a background job and the code path should not be triggered until after the post goes through.
Can you provide more of the logs from when these errors occur? We are not seeing the same thing in our logs and I’d like to find out exactly where it’s happening.
sam
(Sam Saffron)
October 27, 2015, 8:09pm
5
yeah curious, what is the end user impact here? if the bg job fails its just log noise (log noise that we should fix)
kcoop
(Ken Cooper)
October 27, 2015, 8:34pm
6
No end user impact AFAICT. Just log noise. But as a noob it’s comforting not to see error messages in my log.
BTW, what’s the best way to report other error messages I’m seeing? Just post them as bug topics? Do you care?
Also, major kudos for the log system. Love it that JS errors appear there as well.
We need the complete stack trace, can you please post it here?
sam
(Sam Saffron)
October 27, 2015, 11:25pm
8
Feel free to report errors as you go, in existing topics or new ones. Or even submit PRs if you can.
This one does look like an oversight, easily fixable. Indicates that the post was deleted by the time the job queue caught up to creating alerts
kcoop
(Ken Cooper)
October 27, 2015, 11:33pm
9
Ok, but I think this one’s pretty obvious.
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:324:in `raise_record_not_found_exception!'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:444:in `find_one'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:423:in `find_with_ids'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:71:in `find'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/querying.rb:3:in `find'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.4/lib/active_record/core.rb:131:in `find'
/var/www/discourse/app/jobs/regular/post_alert.rb:6:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'
If that’s the case we should ignore this set of conditions @eviltrout .
kcoop
(Ken Cooper)
October 27, 2015, 11:38pm
11
Whenever I create a forked repo, it gets tempting to make my own changes…
But I do see the value.
eviltrout
(Robin Ward)
October 28, 2015, 5:04pm
12
Thanks. It looks like the code tried to do this but used find
which does not return nil
for missing posts.
Fixed here:
https://github.com/discourse/discourse/commit/971af6a762d64afc24cc6a0c451322672a9d68fc
3 Likes