Skip to content

Missing Reviewers group on PR breakes SQL Database #23738

Closed
@sgabenov

Description

@sgabenov

Description

We have 2 instances of gitea server, where we testing enabling LDAP Grout sync with organizations and teams. After we have enabled this config, when we open a PR we got 500 Error. On the SQL Database side logs show this error. DB restarts in cycle all the time on both instances.

How To reproduce this issue:

  1. Create local Team1 in Organization1
  2. Add LDAP_User1 to Local_Team1 (Users from LDAP already imported to gitea)
  3. In Repo1 from Organization1 create a PR to master branch
  4. Enable LDAP groups in gitea configuration, create new LDAP_Team2 in Organization1
  5. Map LDAP group so LDAP_User1 is added to newly created LDAP_Team2
  6. Check that LDAP_User1 is added to Local_Team1 and LDAP_Team2
  7. Delete Local_Team1
  8. Try to open PR from step "3", get 500 error
db_1      | 2023-03-27 06:51:01.641 UTC [7117] ERROR:  canceling statement due to user request
db_1      | 2023-03-27 06:51:01.641 UTC [7117] STATEMENT:  SELECT "id", "user_id", "repo_id", "status", "source", "issue_id", "commit_id", "comment_id", "updated_by", "created_unix", "updated_unix" FROM "notification" WHERE (user_id = $1) AND "status" IN ($2,$3) ORDER BY updated_unix DESC LIMIT 20
db_1      | 2023-03-27 07:35:02.300 UTC [1] LOG:  received smart shutdown request
db_1      | 2023-03-27 07:35:02.330 UTC [1] LOG:  background worker "logical replication launcher" (PID 33) exited with exit code 1
db_1      | 
db_1      | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1      | 
db_1      | 2023-03-27 07:35:41.908 UTC [1] LOG:  starting PostgreSQL 12.1 (Debian 12.1-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1      | 2023-03-27 07:35:41.908 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1      | 2023-03-27 07:35:41.909 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1      | 2023-03-27 07:35:41.911 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1      | 2023-03-27 07:35:41.931 UTC [27] LOG:  database system was interrupted; last known up at 2023-03-27 07:30:18 UTC
db_1      | 2023-03-27 07:35:41.979 UTC [27] LOG:  database system was not properly shut down; automatic recovery in progress
db_1      | 2023-03-27 07:35:41.982 UTC [27] LOG:  redo starts at 28/EFBF96E0
db_1      | 2023-03-27 07:35:41.993 UTC [27] LOG:  invalid record length at 28/EFCEBE90: wanted 24, got 0

db_1      | 2023-03-27 07:35:41.994 UTC [27] LOG:  redo done at 28/EFCEBE48
db_1      | 2023-03-27 07:35:42.038 UTC [1] LOG:  database system is ready to accept connections

gitea_2

The config of LDAP mapping

gitea_3

{
  "CN=emb,OU=Groups,OU=CO_Users,DC=my_org,DC=com": {
    "sandbox": [
      "ldap_embedded"
    ]
  },
  "CN=Leads,OU=Groups,OU=CO_Users,DC=my_org,DC=com": {
    "antiq": [
      "ldap_leads"
    ],
    "applications": [
      "ldap_leads"
    ],
    "libraries": [
      "ldap_leads"
    ],
    "autoqa": [
      "ldap_leads"
    ],
    "devops": [
      "ldap_leads"
    ],
    "docker": [
      "ldap_leads"
    ],
    "emb_conan": [
      "ldap_leads"
    ],
    "emb_devsec": [
      "ldap_leads"
    ],
    "emb_mirrors": [
      "ldap_leads"
    ],
    "release_activity": [
      "ldap_leads"
    ]
  },
  "CN=emb_devops,OU=Groups,OU=CO_Users,DC=my_org,DC=com": {
    "antiq": [
      "ldap_emb_devops"
    ],
    "applications": [
      "ldap_emb_devops"
    ],
    "libraries": [
      "ldap_emb_devops"
    ],
    "autoqa": [
      "ldap_emb_devops"
    ],
    "devops": [
      "ldap_emb_devops"
    ],
    "docker": [
      "ldap_emb_devops"
    ],
    "emb_conan": [
      "ldap_emb_devops"
    ],
    "emb_devsec": [
      "ldap_emb_devops"
    ],
    "emb_mirrors": [
      "ldap_emb_devops"
    ],
    "release_activity": [
      "ldap_emb_devops"
    ]
  },
  "CN=edt_devops,OU=Groups,OU=CO_Users,DC=my_org,DC=com": {
    "devops": [
      "ldap_edt_devops"
    ]
  },
  "CN=emb_kml,OU=Groups,OU=CO_Users,DC=my_org,DC=com": {
    "applications": [
      "ldap_emb_mail"
    ],
    "libraries": [
      "ldap_emb_mail"
    ],
    "emb_conan": [
      "ldap_emb_mail"
    ],
    "emb_mirrors": [
      "ldap_emb_mail"
    ],
    "release_activity": [
      "ldap_emb_mail"
    ]
  },
  "CN=dev_focus,OU=Groups,OU=CO_Users,DC=my_org,DC=com": {
    "applications": [
      "ldap_emb_focus"
    ],
    "libraries": [
      "ldap_emb_focus"
    ],
    "emb_conan": [
      "ldap_emb_focus"
    ],
    "emb_mirrors": [
      "ldap_emb_focus"
    ],
    "release_activity": [
      "ldap_emb_focus"
    ]
  },
  "CN=emb_antiq,OU=Groups,OU=CO_Users,DC=my_org,DC=com": {
    "antiq": [
      "ldap_emb_antiq"
    ],
    "libraries": [
      "ldap_emb_antiq"
    ],
    "emb_conan": [
      "ldap_emb_antiq"
    ],
    "emb_mirrors": [
      "ldap_emb_antiq"
    ]
  },
  "CN=emb_skm,OU=Groups,OU=CO_Users,DC=my_org,DC=com": {
    "applications": [
      "ldap_emb_squadus"
    ],
    "libraries": [
      "ldap_emb_squadus"
    ],
    "emb_conan": [
      "ldap_emb_squadus"
    ],
    "emb_mirrors": [
      "ldap_emb_squadus"
    ]
  },
  "CN=emb_qa,OU=Groups,OU=CO_Users,DC=my_org,DC=com": {
    "applications": [
      "ldap_emb_qa"
    ],
    "libraries": [
      "ldap_emb_qa"
    ],
    "autoqa": [
      "ldap_emb_qa"
    ],
    "release_activity": [
      "ldap_emb_qa"
    ]
  }
}

Gitea Version

1.19.0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Docker

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions