mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-21 20:35:31 -05:00
Search Functionality Issues with Bleeve Engine #13242
Closed
opened 2025-11-02 10:35:56 -06:00 by GiteaMirror
·
34 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.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.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#13242
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @amix307 on GitHub (Jul 5, 2024).
Description
Hi,
I'm following up on my previous ticket: https://github.com/go-gitea/gitea/issues/30064. I always keep the service updated to the latest version, and the search problem persists even on version 1.22.1. I'm using the inbuilt Bleeve engine.
Here’s another example of the issue:
When searching for the string "services.gradle.org", there is one file in the repository where this string should be found. However, the Exact search method does not find the result, and the Fuzzy search hangs for about 2-3 minutes without finding anything.
To give more context about my instance: I have about 300 organizations and 3000 repositories, but overall the size is small as I don't have heavy files. I know for sure that there are many occurrences of the search string across default branches, likely several hundred. Despite this, the Exact search method returns only about 10 results and does so instantly. The Fuzzy search, however, hangs indefinitely. On version 1.21.11, I even encountered a 500 error and the Gitea service restarted.
Manual re-indexing does not help. I would like to resolve the search issues and have more transparent ways to understand how the code is indexed and to have more flexible control over Bleeve settings.
Thanks in advance for your help. I've attached some screenshots for reference.
Gitea Version
1.22.1
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
Git Version
2.31.1
Operating System
CentOS Stream 9
How are you running Gitea?
Self-Hosted from dl.gitea.org
Database
PostgreSQL
@silverwind commented on GitHub (Jul 5, 2024):
I also noticed this search hanging starting with v1.22. If kept running, gitea continously consumes more and more memory up until the point where it exhausts the system resources. It's only for certain search terms, not all of them.
@amix307 commented on GitHub (Jul 5, 2024):
Yes, yesterday my instance hangs and service gitea was restarted with OOM on VM 64gig ram)
@MICCustomsSolutions commented on GitHub (Jul 5, 2024):
Same issue here. Eats all the RAM.
Disabling the index fixes the issue.
@carobme commented on GitHub (Jul 9, 2024):
I can confirm this issue. Using the fuzzy code search with v1.22.1 (self-hosted) results in Gitea memory usage growing until the process runs out of memory.
Rebuilding the index (by stopping Gitea,
rm -rf indexers/*and starting again) doesn't make a difference.@techknowlogick commented on GitHub (Jul 9, 2024):
Pinging @6543
@makar112233 commented on GitHub (Jul 10, 2024):
We're also had same issue
@smartEBL commented on GitHub (Jul 17, 2024):
We are affected by this issue as well. A temporary fix for us is changing
to
Code search on single repository still works then, global search does not (of course). So it would be really nice to see that fixed. Is there anything we could provide for debugging?
@amix307 commented on GitHub (Jul 19, 2024):
@smartEBL now i switched to single-node elasticsearch in container at same vm and it works good, but have same issues with non transparent index mechanism (not searching all)
@nekdan commented on GitHub (Jul 22, 2024):
We also encountered this issue and disabled the search functionality to ensure normal operation. However, this is a poor solution because we need the search functionality for our work.
@lunny commented on GitHub (Jul 22, 2024):
Can anyone reproduce it in the development version? I think it's related to bleve versions.
@kemzeb commented on GitHub (Jul 22, 2024):
I am not yet familiar with how the code search indexing works nor am I familiar with bleve, but this could be the case after looking into the recent bleve releases.
In Gitea v1.21 we use bleve v2.30.10. Gitea v1.22 and onwards uses bleve v2.4.0.
bleve v2.4.1 adds a fix to a memory leak problem associated to their "vector query path" (more specifically, it was a problem in a indirect dependency called blevesearch/go-faiss).
I am not sure if this "path" is something that our code will eventually execute (or if it is only used by the vector indexing feature introduced in bleve v2.4.0), but I wish to bring this up to those that are maybe more familiar.
@silverwind commented on GitHub (Jul 23, 2024):
According to go.mod, gitea v1.22 still uses bleve v2.3.10, so exact same version as v1.21:
https://github.com/go-gitea/gitea/blob/release/v1.22/go.mod#L22
https://github.com/go-gitea/gitea/blob/release/v1.21/go.mod#L21
I think the issue must lie in first-party code.
@kemzeb commented on GitHub (Jul 27, 2024):
After doing the following when firing up my dev Gitea instance:
I was able to notice the huge memory cost. Here is my generated pprof graph for reference.
I also checked out snapshot
1262ff6734(as this was before major changes were made to code search fuzzing) and I did not notice a performance impact on memory when observing my heap usage in the admin dashboard.Don't have time to dig into this further yet, but thought this could be helpful in some way.
@lunny commented on GitHub (Aug 16, 2024):
Bleve has been upgraded to v2.4.2 via #31762 but I don't whether this issue has been resolved.
@amix307 commented on GitHub (Aug 20, 2024):
i can try to test on nightly 1.22
@silverwind commented on GitHub (Aug 29, 2024):
I switched to elasticsearch repo indexer as well now. It seems to be more efficient regarding disk usage than bleve, likely because of missing compression of the bleve index files. I noticed one bug so far in that exact search does not work correctly with elasticsearch, it's always fuzzy.
@smartEBL commented on GitHub (Sep 2, 2024):
@amix307 @silverwind
How do your setups look like now? How did you change the app.ini to achieve that?
@amix307 commented on GitHub (Sep 2, 2024):
@smartEBL commented on GitHub (Sep 2, 2024):
Cool, thanks for the fast reply. And how complicated is the setup/configuration of the elastic search? You also just spawn it inside some docker container? Or were there any big showstoppers you came across?
@silverwind commented on GitHub (Sep 2, 2024):
We're getting offtopic, but it's pretty trivial, for example with
docker run:@planbnet commented on GitHub (Sep 6, 2024):
I just had this problem with a simple search on our local instance running Gitea 1.22.1.
The installation has a few hundred repos and Bleve configured like this:
16 GB of memory are slowly eaten up by the following goroutine (taken from Gitea's monitoring/stacktrace view). Clicking the trash can icon to kill the process does nothing.
GET: /explore/code?q=build.yaml&fuzzy=true[...until here, there are always different function calls listed with each reload of the monitoring view, but the following stacktrace items will always be the same..]github.com/blevesearch/bleve/v2/search/searcher.(*PhraseSearcher).Next/go/pkg/mod/github.com/blevesearch/bleve/v2@v2.3.10/search/searcher/search_phrase.go:229github.com/blevesearch/bleve/v2/search/collector.(*TopNCollector).Collect/go/pkg/mod/github.com/blevesearch/bleve/v2@v2.3.10/search/collector/topn.go:228github.com/blevesearch/bleve/v2.(*indexImpl).SearchInContext/go/pkg/mod/github.com/blevesearch/bleve/v2@v2.3.10/index_impl.go:580code.gitea.io/gitea/modules/indexer/code/bleve.(*Indexer).Search/source/modules/indexer/code/bleve/bleve.go:285code.gitea.io/gitea/modules/indexer/code.PerformSearch/source/modules/indexer/code/search.go:138code.gitea.io/gitea/routers/web/explore.Code/source/routers/web/explore/code.go:80@johanvdw commented on GitHub (Sep 6, 2024):
This is not solved on gitea 1.22.2
@planbnet commented on GitHub (Sep 6, 2024):
Just tested it with 1.22.2, still the exact same issue.
To prevent unintended DOS attacks on our server, I've disabled the fuzzy search with a small nginx hack:
If there's a cleaner workaround to keep the indexer, but disable fuzzy search, please let me know.
@jpraet commented on GitHub (Oct 17, 2024):
I also got hit by this unpleasant surprise of OOM crashes after upgrading to gitea 1.22.
When such a significant problem is discovered in a new release, it would be nice if a warning would be added to the release notes and blog posts.
Are we sure this is an upstream issue? Given https://github.com/go-gitea/gitea/issues/31565#issuecomment-2244027712
@jpraet commented on GitHub (Oct 18, 2024):
Perhaps this one is related? https://github.com/go-gitea/gitea/pull/29706
@lunny commented on GitHub (Oct 18, 2024):
Did you mean it will happen only for fuzzy searching?
@jpraet commented on GitHub (Oct 18, 2024):
Yes, exact search seems to be working fine, hence https://github.com/go-gitea/gitea/issues/31565#issuecomment-2333563036.
@jpraet commented on GitHub (Nov 21, 2024):
I want to raise some attention to this issue @go-gitea/maintainers, as it causes OOM crashes of gitea instance.
@johanvdw commented on GitHub (Nov 21, 2024):
yes, it is a security issue.
@lunny commented on GitHub (Nov 21, 2024):
Maybe we can have an option to disable fuzzy search at first.
@wxiaoguang commented on GitHub (Nov 22, 2024):
I can see some related bleeve related fuzzy changes in 1.22 : Determine fuzziness of bleve indexer by keyword length #29706 , Expose fuzzy search for issues/pulls #29701
Just a guess, would reverting #29706 resolve the problem? also cc @6543
@6543 commented on GitHub (Nov 22, 2024):
👀
@lunny commented on GitHub (Jan 2, 2025):
We can temporarily disable fuzzy search for the bleve search engine in v1.23.
@wxiaoguang commented on GitHub (Jan 2, 2025):
@6543 then we need another dirty patch to the indexer system: Fix bleve fuzziness search #33078