`GIT_TRACE=1 git lfs push --all origin` results in HTTP 500 Fatal Server Error
Summary
GIT_TRACE=1 git lfs push --all origin
results in HTTP 500 Fatal Server Error.
I'm on Windows 10 Pro, 10.0.18362 Build 18362. I have Docker v20.10.2 installed with Linux Containers, using WSL 2 based engine, switched on. At the time of writing this, I'm using gitlab/gitlab-ee:latest which is version 13.9.3-ee.
Documentation I've referenced:
https://docs.gitlab.com/ee/topics/git/lfs/
https://docs.gitlab.com/ee/topics/git/lfs/migrate_to_git_lfs.html
https://docs.gitlab.com/ee/administration/lfs/index.html#configuration-for-omnibus-installations
Several other issues and forum threads that are slightly related, but did not help my particular case:
https://forum.gitlab.com/t/git-lfs-upload-throws-500-after-upload/15312
https://forum.gitlab.com/t/getting-a-fatal-error-server-error-when-uploading-to-lfs/38852
Steps to reproduce
- open powershell
docker pull gitlab/gitlab-ee:latest
mkdir C:\gitlab
$Env:GITLAB_HOME = C:\gitlab
-
docker run --rm -d --publish 80:80 --name gitlab --hostname localhost -v $Env:GITLAB_HOME\config:/etc/gitlab -v $Env:GITLAB_HOME\logs:/var/log/gitlab -v $Env:GITLAB_HOME\data:/var/opt/gitlab 268f0203065b
where268f0203065b
is the gitlab/gitlab-ee:latest image ID docker exec -it gitlab bash
-
vim /etc/gitlab/gitlab.rb
and uncomment lines withgitlab_rails['lfs_enabled']
andgitlab_rails['lfs_storage_path']
gitlab-ctl reconfigure
- open git-bash
mkdir Foo
cd Foo
git init Foo
- put a random binary file in the project folder. Let's call it
foo.bin
git add foo.bin
git commit -m "init"
cd ..
git clone --mirror Foo
- Download and install BFG and all of its dependencies: https://rtyley.github.io/bfg-repo-cleaner/
alias bfg="java -jar /c/absolute/path/to/bfg.jar"
bfg --convert-to-git-lfs ".bin" --no-blob-protection Foo.git
cd Foo.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git lfs install
- visit http://localhost
- click on
New project
- click on
Create blank project
and name itFoo
git remote set-url origin http://localhost/root/foo.git
git config lfs.url http://localhost/root/foo.git/info/lfs
GIT_TRACE=1 git lfs push --all origin
Example Project
What is the current bug behavior?
Here's a snippet of the git-lfs trace:
20:30:18.479230 trace git-lfs: tq: starting transfer adapter "basic"
20:30:18.480236 trace git-lfs: HTTP: PUT http://localhost/root/foo.git/gitlab-lfs/objects/2dacadcc70cc122054e60914cbc6b689f685bef5713915a90f4185dd9da7954e/90688487
20:30:25.559483 trace git-lfs: HTTP: 500 | 23 MB/s
20:30:25.559483 trace git-lfs: tq: retrying object 2dacadcc70cc122054e60914cbc6b689f685bef5713915a90f4185dd9da7954e: Fatal error: Server error: http://localhost/root/foo.git/gitlab-lfs/objects/2dacadcc70cc122054e60914cbc6b689f685bef5713915a90f4185dd9da7954e/90688487
Here's a snippet of gitlab-rails/production.log. Not sure what other logs have interesting information. I had trouble looking for a good error message that hinted at how I should go about re-configuring the gitlab container.
Processing by Repositories::LfsStorageController#upload_finalize as HTML
Parameters: {"file.gitlab-workhorse-upload"=>"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cGxvYWQiOnsibWQ1IjoiMDdmNmU4NmY4Yzc0MzI0MTI0YzkwY2FkODQ3MmI4YzUiLCJuYW1lIjoiMWM4MjgyNzk2YzQ4YTA0ZTM3OWFhMmJiYmQzMDM1N2MzZDMyZWRmYjIzZmU4YjYxZjg0MDE3ZTM0YWI1MWNkMiIsInBhdGgiOiIvdmFyL29wdC9naXRsYWIvZ2l0bGFiLXJhaWxzL3NoYXJlZC9sZnMtb2JqZWN0cy90bXAvdXBsb2Fkcy8xYzgyODI3OTZjNDhhMDRlMzc5YWEyYmJiZDMwMzU3YzNkMzJlZGZiMjNmZThiNjFmODQwMTdlMzRhYjUxY2QyNzEyNzkwNjUwIiwicmVtb3RlX2lkIjoiIiwicmVtb3RlX3VybCI6IiIsInNoYTEiOiJmNWNlYzU3OGI4NGFkMmE2NWNmZTBhZDhkNWYwMzU1MWQ5MDRjNjM1Iiwic2hhMjU2IjoiMWM4MjgyNzk2YzQ4YTA0ZTM3OWFhMmJiYmQzMDM1N2MzZDMyZWRmYjIzZmU4YjYxZjg0MDE3ZTM0YWI1MWNkMiIsInNoYTUxMiI6IjliYWIwODUxZTBiMWNjNjVlMTNiOWEyYzdmZWQzMmYzY2U3ZjljODRiODUyYzBmOGYwODk4MGY1MzYzNDNiODBmMTJkODY4NjhiZDZkYTdlYzk1YTA1OGJiNjY4ZWE2YjJlMWMxYTg3MDE4YTE2NDZmNGY3ZGNjYmQzMWQwZDJlIiwic2l6ZSI6IjE0MzY0NjcyIn0sImlzcyI6ImdpdGxhYi13b3JraG9yc2UifQ.rhU0V40EkB8M6Zjxvj-cH4_xxJ3Rakw_oIS5eoVDcgM", "file.md5"=>"07f6e86f8c74324124c90cad8472b8c5", "file.name"=>"1c8282796c48a04e379aa2bbbd30357c3d32edfb23fe8b61f84017e34ab51cd2", "file.path"=>"/var/opt/gitlab/gitlab-rails/shared/lfs-objects/tmp/uploads/1c8282796c48a04e379aa2bbbd30357c3d32edfb23fe8b61f84017e34ab51cd2712790650", "file.remote_id"=>"", "file.remote_url"=>"", "file.sha1"=>"f5cec578b84ad2a65cfe0ad8d5f03551d904c635", "file.sha256"=>"1c8282796c48a04e379aa2bbbd30357c3d32edfb23fe8b61f84017e34ab51cd2", "file.sha512"=>"9bab0851e0b1cc65e13b9a2c7fed32f3ce7f9c84b852c0f8f08980f536343b80f12d86868bd6da7ec95a058bb668ea6b2e1c1a87018a1646f4f7dccbd31d0d2e", "file.size"=>"14364672", "file"=>#<UploadedFile:0x00007f62f04045e8 @tempfile=#<File:/var/opt/gitlab/gitlab-rails/shared/lfs-objects/tmp/uploads/1c8282796c48a04e379aa2bbbd30357c3d32edfb23fe8b61f84017e34ab51cd2712790650>, @size=14364672, @content_type="application/octet-stream", @original_filename="1c8282796c48a04e379aa2bbbd30357c3d32edfb23fe8b61f84017e34ab51cd2", @sha256="1c8282796c48a04e379aa2bbbd30357c3d32edfb23fe8b61f84017e34ab51cd2", @remote_id="">, "repository_path"=>"root/foo.git", "oid"=>"1c8282796c48a04e379aa2bbbd30357c3d32edfb23fe8b61f84017e34ab51cd2", "size"=>"14364672"}
Completed 500 Internal Server Error in 885ms (ActiveRecord: 750.5ms | Elasticsearch: 0.0ms | Allocations: 33670)
Errno::ENOENT (No such file or directory @ apply2files - /var/opt/gitlab/gitlab-rails/shared/lfs-objects/tmp/work/1615258207-17628-0001-5145/1c8282796c48a04e379aa2bbbd30357c3d32edfb23fe8b61f84017e34ab51cd2):
app/uploaders/object_storage.rb:369:in `cache!'
app/controllers/repositories/lfs_storage_controller.rb:95:in `create_file!'
app/controllers/repositories/lfs_storage_controller.rb:83:in `store_file!'
app/controllers/repositories/lfs_storage_controller.rb:41:in `upload_finalize'
ee/lib/gitlab/ip_address_state.rb:10:in `with'
ee/app/controllers/ee/application_controller.rb:44:in `set_current_ip_address'
app/controllers/application_controller.rb:482:in `set_current_admin'
lib/gitlab/i18n.rb:73:in `with_locale'
lib/gitlab/i18n.rb:79:in `with_user_locale'
app/controllers/application_controller.rb:467:in `set_locale'
lib/gitlab/error_tracking.rb:52:in `with_context'
app/controllers/application_controller.rb:532:in `sentry_context'
app/controllers/application_controller.rb:460:in `block in set_current_context'
lib/gitlab/application_context.rb:56:in `block in use'
lib/gitlab/application_context.rb:56:in `use'
lib/gitlab/application_context.rb:22:in `with_context'
app/controllers/application_controller.rb:451:in `set_current_context'
lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call'
lib/gitlab/middleware/rails_queue_duration.rb:33:in `call'
lib/gitlab/metrics/rack_middleware.rb:16:in `block in call'
lib/gitlab/metrics/transaction.rb:56:in `run'
lib/gitlab/metrics/rack_middleware.rb:16:in `call'
lib/gitlab/request_profiler/middleware.rb:17:in `call'
lib/gitlab/jira/middleware.rb:19:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:21:in `call'
lib/gitlab/middleware/multipart.rb:177:in `block in call'
lib/gitlab/middleware/multipart.rb:63:in `with_open_files'
lib/gitlab/middleware/multipart.rb:176:in `call'
lib/gitlab/middleware/read_only/controller.rb:50:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
lib/gitlab/middleware/request_context.rb:21:in `call'
config/initializers/fix_local_cache_middleware.rb:11:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:76:in `call'
lib/gitlab/middleware/release_env.rb:12:in `call'
What is the expected correct behavior?
A git-lfs trace that has no HTTP 500 and zero fatal server errors
Relevant logs and/or screenshots
See bug behavior section above
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info (from docker container)
root@localhost:/# gitlab-rake gitlab:env:infoSystem information System: Proxy: no Current User: git Using RVM: no Ruby Version: 2.7.2p137 Gem Version: 3.1.4 Bundler Version:2.1.4 Rake Version: 13.0.3 Redis Version: 6.0.10 Git Version: 2.29.0 Sidekiq Version:5.2.9 Go Version: unknown
GitLab information Version: 13.9.3-ee Revision: 332cf9cc57c Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 12.5 URL: http://localhost HTTP Clone URL: http://localhost/some-group/some-project.git SSH Clone URL: git@localhost:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 13.17.0 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check (from docker container)
root@localhost:/# gitlab-rake gitlab:check SANITIZE=true Checking GitLab subtasks ...Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 13.17.0 ? ... OK (13.17.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/1 ... yes 1/9 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.2) Git version >= 2.29.0 ? ... yes (2.29.0) Git user has default SSH configuration? ... yes Active users: ... 1 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x (6.4 - 6.x deprecated to be removed in 13.8)? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished