# 部分用户在加载摘要页面时出现 500 错误（beta4）

**URL:** https://meta.discourse.org/t/500-error-loading-summary-page-for-some-users-beta4/101796
**Category:** Support
**Created:** [2018年十一月11日 19:56 UTC](https://meta.discourse.org/t/500-error-loading-summary-page-for-some-users-beta4/101796 "2018-11-11T19:56:28Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年十一月12日 06:39 UTC](https://meta.discourse.org/t/500-error-loading-summary-page-for-some-users-beta4/101796/2 "2018-11-12T06:39:20Z")

</div>

Hmmm I am torn on fixing this @eviltrout

> <https://github.com/discourse/discourse/blob/d1684a165259b8426b4e84d2099281023d76d908/app/models/user_summary.rb#L190-L199>

This repros the issue:

```ruby
  it "is robust enough to handle bad data" do
    UserActionCreator.enable

    liked_post = create_post
    user = Fabricate(:user)
    PostAction.act(user, liked_post, PostActionType.types[:like])

    users = UserSummary.new(user, Guardian.new).most_liked_users

    expect(users.map(&:id)).to eq([liked_post.user_id])

    # really we should not be corrupting stuff like this
    # but in production dbs this can happens sometimes I guess
    liked_post.user.delete

    users = UserSummary.new(user, Guardian.new).most_liked_users
    expect(users).to eq([])

  end

```

But you should not be doing `#delete` on users and leaving a mess around.

Simplest workaround is hunting for all the `acting_user_id` in `user_actions` table that do not have records in `users` table and nuking properly.

Since I have not seen this in our logs across 1000 sites I am somewhat reluctant to patch the code to allow for this corruption.

---

_[View the full topic](https://meta.discourse.org/t/500-error-loading-summary-page-for-some-users-beta4/101796)._
