git clone fail : fatal: Out of memory, malloc failed (tried to allocate 905976064 bytes) - git-clone

When I perform a git clone from another project on git hub I get following error message:
Cloning into 'starter'...
fatal: Out of memory, malloc failed (tried to allocate 905976064 bytes)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

Related

Why I can't download buildrot package in docker

I am trying to build my own linux image using buildroot in docker with GitLab CI. Everything is going fine until I start downloading the "linux" repository. Then I get an error like below.
>>> linux d0f5c460aac292d2942b23dd6199fe23021212ad Downloading
Doing full clone
Cloning into bare repository 'linux-d0f5c460aac292d2942b23dd6199fe23021212ad'...
Looking up git.ti.com ... done.
Connecting to git.ti.com (port 9418) ... 198.47.28.207 done.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
--2023-01-05 11:53:37-- http://sources.buildroot.net/linux-d0f5c460aac292d2942b23dd6199fe23021212ad.tar.gz
Resolving sources.buildroot.net (sources.buildroot.net)... 104.26.1.37, 172.67.72.56, 104.26.0.37, ...
Connecting to sources.buildroot.net (sources.buildroot.net)|104.26.1.37|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2023-01-05 11:53:37 ERROR 404: Not Found.
package/pkg-generic.mk:73: recipe for target '/builds/XXX/XXX/output/build/linux-d0f5c460aac292d2942b23dd6199fe23021212ad/.stamp_downloaded' failed
make: *** [/builds/XXX/XXX/output/build/linux-d0f5c460aac292d2942b23dd6199fe23021212ad/.stamp_downloaded] Error 1
Cleaning up project directory and file based variables
00:02
ERROR: Job failed: exit code 1
The image being built without docker has no problem downloading this repository. I was building this image in docker a while ago and there was no problem downloading this repository. Could it be a problem of poorer network connection? The package is bigger than the others
You are using a custom git repo (git.ti.com) which is not working and buildroot doesn't know anything about.
For this reason, you cannot expect a mirror copy available on sources.buildroot.net: buildroot only has copies of the packages distributed whithin it.

Unable to untar the xx.tar.zst file with the error "zstd: /*stdin*\: unsupported format"

I cloned a large tar file from the address: https://github.com/uni-due-syssec/evmpatch-eval-data/tree/master/large-scale;
but when I untar it in the Linux system with the command tar -I zstd -xvf osiris_dataset_14k.tar.zst, I encounter the following errors:
zstd: /*stdin*\: unsupported format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
I surf on the internet but don't find the solution
The file in question is stored in that git repo as a Git LFS Record. I suspect what you are trying to decompress is just the LFS pointer, which looks like this:
version https://git-lfs.github.com/spec/v1
oid sha256:1b6282bef881e59ad83ac4aecc27fc41025bec88ed8b44983e904372fdd22fd4
size 753961811
So Zstd is accurately reporting that it is being given data that is not zstd-compressed, and it can't decompress it.
The file you have pasted is a Git LFS record (reference to, not the actual file).
The first step should be to retrieve the file, therefore, install Git LFS - see more details on installing LFS here: https://packagecloud.io/github/git-lfs/install
After its installed run:
git lfs fetch
That will initiate the downloading process, and then you can run the tar command.
If you already have Git LFS installed you can just use:
git clone ...
And you don't need the two steps mentioned above - you should see if you have LFS installed during the cloning:
Downloading LFS objects: 0% (0/1), 285 MB | 5.3 MB/s

git push heroku master error: Could not read

I tried looking through some git push heroku master errors on this website, but I couldn't find one with my specific problem. Hopefully you guys can help me.
When I run git push heroku master
error: Could not read 6f2abfc273544edc8fa8fbf18837a9ecec606bb2
fatal: bad tree object 6f2abfc273544edc8fa8fbf18837a9ecec606bb2
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'https://git.heroku.com/still-harbor-74893.git'
fatal: write error: Bad file descriptor`
I've read that Heroku sets a hard limit on file sizes, is that the problem?
Check whether your github file is corrupted or not. Or maybe one of the file is corrupted. I can't think of anything else that might be the problem here.
I'm guessing that your repository/current directory is broken. If you think that your current working directory contains uncorrupted files, then you can always re-initialize Git in your working directory. For example:
rm -rf .git
git init
git add .
git commit -m 'Re-initialize repo.'
And then try to push to heroku.

docker generates "fatal: write error: Read-only file" using git clone

Question How do I avoid "fatal: write error: Read-only file" problem when using git clone.
Error occurs inside a docker instance
docker run -it imagename /bin/bash
RESULTS:
root#imagename:~/# git clone user#address:repo dir_name
Cloning into 'dir_name'...
remote: Counting objects: 79344, done.
remote: Compressing objects: 100% (30878/30878), done.
fatal: write error: Read-only file system76 GiB | 5.31 MiB/s
fatal: index-pack failed
What is the correct magic invocation to do this successfully ?
I saw this error when the docker storage space were full (limit in 20GB).
If you pulled too much images or run too many containers, you will see this error.
Clean some images or container will help.

rails + git + heroku - error on git push

I'm trying to push my app to heroku using: git push heroku master the process runs fine for a little while then spits out all kinds of errors that I've never seen before and I can't find much help on google.
Here is the error log form console:
XXXXX-MacBook-XXXXXX xxxx$ git push heroku master
Counting objects: 7885, done.
Delta compression using up to 4 threads.
git(237,0xb0185000) malloc: *** mmap(size=81125376) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
warning: suboptimal pack - out of memory
git(237,0xb0185000) malloc: *** mmap(size=93798400) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
git(237,0xb0185000) malloc: *** mmap(size=93798400) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
fatal: Out of memory, malloc failed (tried to allocate 93797389 bytes)
error: pack-objects died with strange error
error: failed to push some refs to 'git#heroku.com:xxxxx-xxx-xx.git'
Anyone know what this all means and why it's happening?
Also, i noticed that my:
/Users/xxxxxx/Sites/xxxxxx/.git/objects folder is 700+ megs, not sure if that's normal or not as I'm new to rails and github.
Thank you for any help.
Most of the problem-solving is in the comments above; by the time we moved over to chat, things were pretty much taken care of. Here's an answer, just to help close out the question.
It seems that there was some unknown problem in the repository causing the objects directory to grow out of control. We didn't really need to determine what this was, because all of the commits had already been pushed to the github repository. Simply recloning from there (hooray for DVCS providing free backups) created a perfectly good repository to replace the old one.
Moral of the story: If your .git directory is 20 times the size of your content, and it causes malloc/mmap failures during routine operations, something's probably wrong with your repo.
short answer:
before doing git push heroku master, run git repack -a -d --window-memory=200m
why?
from what I understand, git push runs git gc, which runs git repack.
the problem is that if no maximum memory size is passed, then git will take up unlimited amount of memory (aka all of the memory in your computer) when compressing..hence the out of memory error.
so before doing git push heroku master, run git repack -a -d --window-memory=200m
this will use a maximum of 200MB of memory when compressing, hence preventing the process running out of memory.
see http://linux.die.net/man/1/git-repack for more details.
Should be able to limit the packsize to 100mb and limit the thread number to 1:
$ git config --global pack.packSizeLimit "100m"
$ git config --global pack.threads "1"

Resources