Skip to content

HTTP 500 on explore/code search after repo delete (with enabled code indexer via elasticsearch) #19076

Closed
@IT-AlexKor

Description

@IT-AlexKor

Gitea Version

1.16.3

Git Version

1.8.3.1

Operating System

CentOS Linux 7 (Core)

How are you running Gitea?

Self-hosted instance in ProxMox

configuration:

APP_NAME = <ERASED>
RUN_USER = git
RUN_MODE = prod

[security]
INTERNAL_TOKEN     = <ERASED>
INSTALL_LOCK       = true
SECRET_KEY         = <ERASED>
PASSWORD_HASH_ALGO = pbkdf2
DISABLE_GIT_HOOKS  = false

[database]
DB_TYPE  = postgres
HOST     = <ERASED>
NAME     = <ERASED>
USER     = <ERASED>
PASSWD   = <ERASED>
SCHEMA   =
SSL_MODE = disable
CHARSET  = utf8
PATH     = /var/lib/gitea/data/gitea.db
LOG_SQL  = false

[repository]
ROOT = /var/lib/gitea/data/gitea-repositories

[server]
SSH_DOMAIN       = <ERASED>
DOMAIN           = <ERASED>
HTTP_PORT        = 3000
ROOT_URL         = https://<ERASED>/
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /var/lib/gitea/data/lfs
LFS_JWT_SECRET   = <ERASED>
OFFLINE_MODE     = false

[mailer]
ENABLED = true
HOST    = <ERASED>
FROM    = <ERASED>
USER    =
PASSWD  =

[service]
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
DISABLE_REGISTRATION              = false
ALLOW_ONLY_EXTERNAL_REGISTRATION  = false
ENABLE_CAPTCHA                    = false
REQUIRE_SIGNIN_VIEW               = true
DEFAULT_KEEP_EMAIL_PRIVATE        = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING       = true
NO_REPLY_ADDRESS                  = noreply.localhost

[picture]
DISABLE_GRAVATAR        = false
ENABLE_FEDERATED_AVATAR = true

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

[session]
PROVIDER = file

[log]
MODE      = console
LEVEL     = info
ROOT_PATH = /var/lib/gitea/log
ROUTER    = console

[metrics]
ENABLED = true

[mirror]
MIN_INTERVAL = 1m

[indexer]
ISSUE_INDEXER_TYPE = elasticsearch
ISSUE_INDEXER_CONN_STR = http://<ERASED>:9200
ISSUE_INDEXER_NAME = gitea_issues
ISSUE_INDEXER_PATH = indexers/issues.bleve
REPO_INDEXER_ENABLED = true
REPO_INDEXER_TYPE = elasticsearch
REPO_INDEXER_CONN_STR = http://<ERASED>:9200
REPO_INDEXER_NAME = gitea_codes
REPO_INDEXER_PATH = indexers/repos.bleve
UPDATE_BUFFER_LEN = 20
MAX_FILE_SIZE = 1048576
REPO_INDEXER_INCLUDE =
REPO_INDEXER_EXCLUDE = resources/bin/**
STARTUP_TIMEOUT = 30s

Database

PostgreSQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

Steps to reproduce:

  1. (maybe can be skipped) Migrate repo with pulling enabled
  2. (maybe can be skipped) Convert repo to regular
  3. Force repo code indexing by pressins button "Add to Reindex Queue" (in repo settings), wait until it ends
  4. Search from some code string in this repo via Explore/Code (type "match"). You should see your code in this repo
  5. Delete repo via "Delete This Repository" button (in repo settings)
  6. Repeat you search from step 4. You will receive HTTP 500 from https://.../explore/code?tab=&q=addSbtPlugin&t=match

Error from logs

Mar 14 12:37:07 ci-gitea gitea: #033[36m2022/03/14 12:37:07 #033[0mStarted #033[34mGET#033[0m #033[1m/explore/code?tab=&q=addSbtPlugin&t=match#033[0m for #033[1m127.0.0.1:55048#033[0m

Mar 14 12:37:08 ci-gitea gitea: #033[36m2022/03/14 12:37:08 #033[0m#033[32m...v7@v7.0.25/client.go:1500:#033[32mPerformRequest()#033[0m #033[1;32m[I]#033[0m #033[1mPOST#033[0m #033[1mhttp://<ERASED>:9200/gitea_codes/_search#033[0m [status:#033[1m200#033[0m, request:#033[1m0.842#033[0ms]

Mar 14 12:37:08 ci-gitea gitea: #033[36m2022/03/14 12:37:08 #033[0m#033[32m...s/context/context.go:208:#033[32mHTML()#033[0m #033[1;31m[E]#033[0m #033[1mRender failed#033[0m: #033[1mtemplate: explore/code:41:40: executing "explore/code" at <$repo.HTMLURL>: error calling HTMLURL: runtime error: invalid memory address or nil pointer dereference#033[0m

Mar 14 12:37:08 ci-gitea gitea: #033[36m2022/03/14 12:37:08 #033[0mCompleted #033[34mGET#033[0m #033[1m/explore/code?tab=&q=addSbtPlugin&t=match#033[0m #033[1;41m500#033[0m #033[1;41mInternal Server Error#033[0m in #033[33m875.460841ms#033[0m

If you need more information - please tell

Screenshots

No response

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