Windows - Code indexer fails due to long command line #12405

Closed
opened 2025-11-02 10:08:50 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @Sebazzz on GitHub (Jan 30, 2024).

Description

Observed in the log:

2024/01/30 08:13:20 ...exer/code/indexer.go:128:func2() [E] Codes indexer handler: index error for repo 329: fork/exec C:/Program Files/Git/bin/git.exe: The filename or extension is too long.
2024/01/30 08:13:20 ...queue/workergroup.go:102:doWorkerHandle() [E] Queue "code_indexer" failed to handle batch of 2 items, backoff for a few seconds

Turning on debug logging, Gitea attempts to execute the command as follows:

2024/01/30 08:13:20 ...dules/git/command.go:290:Run() [D] git.Command.RunDir(D:\Gitea\data\repositories\minszw\smart-ns.git): "C:/Program Files/Git/bin/git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= ls-tree --full-tree -l 1fe04fdf997673b19f538b378fd53210d3ed5d09 -- .gitignore .osv-config.toml ".run/Command-line_ create organization.run.xml" ".run/Standalone (no browser).run.xml" [every file in the repository here]

In our case, this amounts to about 502000 character command line. This exceeds the limit of 32767 characters in Windows, and thus the command fails.

Gitea Version

1.21.4

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

git version 2.39.2.windows.1

Operating System

Windows Server 2022

How are you running Gitea?

go-gitea version (but happens with git version too) 1.21.4 built with GNU Make 4.3, go1.21.5 : bindata, sqlite, sqlite_unlock_notify connected to MSSQL

Database

MSSQL

Originally created by @Sebazzz on GitHub (Jan 30, 2024). ### Description Observed in the log: ``` 2024/01/30 08:13:20 ...exer/code/indexer.go:128:func2() [E] Codes indexer handler: index error for repo 329: fork/exec C:/Program Files/Git/bin/git.exe: The filename or extension is too long. 2024/01/30 08:13:20 ...queue/workergroup.go:102:doWorkerHandle() [E] Queue "code_indexer" failed to handle batch of 2 items, backoff for a few seconds ``` Turning on debug logging, Gitea attempts to execute the command as follows: ``` 2024/01/30 08:13:20 ...dules/git/command.go:290:Run() [D] git.Command.RunDir(D:\Gitea\data\repositories\minszw\smart-ns.git): "C:/Program Files/Git/bin/git.exe" -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= ls-tree --full-tree -l 1fe04fdf997673b19f538b378fd53210d3ed5d09 -- .gitignore .osv-config.toml ".run/Command-line_ create organization.run.xml" ".run/Standalone (no browser).run.xml" [every file in the repository here] ``` In our case, this amounts to about 502000 character command line. This exceeds [the limit of 32767 characters in Windows](https://devblogs.microsoft.com/oldnewthing/20031210-00/?p=41553), and thus the command fails. ### Gitea Version 1.21.4 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version git version 2.39.2.windows.1 ### Operating System Windows Server 2022 ### How are you running Gitea? go-gitea version (but happens with git version too) `1.21.4 built with GNU Make 4.3, go1.21.5 : bindata, sqlite, sqlite_unlock_notify` connected to MSSQL ### Database MSSQL
GiteaMirror added the issue/duplicate label 2025-11-02 10:08:50 -06:00
Author
Owner

@KN4CK3R commented on GitHub (Jan 30, 2024):

Maybe needs batch processing in this method:
27d4c11ec3/modules/indexer/code/git.go (L104)

@KN4CK3R commented on GitHub (Jan 30, 2024): Maybe needs batch processing in this method: https://github.com/go-gitea/gitea/blob/27d4c11ec3bd1658c07d0bb9b0b7f3712aafb0bb/modules/indexer/code/git.go#L104
Author
Owner

@wxiaoguang commented on GitHub (Jan 30, 2024):

Similar:

-> search indexer broken: ...exer/code/indexer.go:128:func2() [E] Codes indexer handler: index error for repo 29: fork/exec /usr/bin/git: argument list too long #28584

@wxiaoguang commented on GitHub (Jan 30, 2024): Similar: -> search indexer broken: ...exer/code/indexer.go:128:func2() [E] Codes indexer handler: index error for repo 29: fork/exec /usr/bin/git: argument list too long #28584
Author
Owner

@github-actions[bot] commented on GitHub (Feb 29, 2024):

Automatically locked because of our CONTRIBUTING guidelines

@github-actions[bot] commented on GitHub (Feb 29, 2024): Automatically locked because of our [CONTRIBUTING guidelines](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#issue-locking)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12405