bassicplays
bassicplays

Reputation: 358

No memory for git clone

I am on a shared hosting plan and I've done numerous git projects/commands with my web host. However I'm starting a new project which is still pretty small (4MB) compared to a bigger project (8MB) that I am able to successfully host with them without any issues.

When I ran git clone ... command, I got the following:

[email protected] [~/project.domain.com]# git clone [email protected]:dokgu/project.git .
Cloning into '.'...
remote: Enumerating objects: 1925, done.
remote: Counting objects: 100% (1925/1925), done.
remote: Compressing objects: 100% (1642/1642), done.
remote: Total 1925 (delta 305), reused 1864 (delta 271), pack-reused 0
Receiving objects: 100% (1925/1925), 3.61 MiB | 8.54 MiB/s, done.
fatal: unable to create thread: Resource temporarily unavailable
fatal: index-pack failed

I already tried calling their technical support line but they weren't any help.

I was also trying to see the memory status of my account and this is what I found:

[email protected] [~]# free -m
             total       used       free     shared    buffers     cached
Mem:        128963     126375       2587        245      17221      76232
-/+ buffers/cache:      32920      96042
Swap:         5999        362       5637

As you can see, I only have 2.5MB of available memory but when I try to list any processes that are taking memory:

[email protected] [~]# ps aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
dokgu          1  0.0  0.0  16628  2776 ?        SN   18:28   0:00 /usr/local/cpanel/bin/jailshell -l
dokgu         52  0.0  0.0  18508  2064 ?        RN+  18:31   0:00 ps aux

What do I do from here when the hosting company's technical support isn't even able to help me?

Upvotes: 1

Views: 253

Answers (1)

bk2204
bk2204

Reputation: 76964

The problem you're seeing is that git index-pack, which is threaded, is unable to create the threads which it uses, probably because it's artificially limited. The relevant limit on Linux is RLIMIT_NPROC, which controls the number of threads that can be started at once.

Unfortunately, while git index-pack has an option to control the number of threads, it isn't possible to pass it when it's being used under the hood from git fetch or git clone, and there's no configuration option to control it.

You have some options here, though:

  • Try to raise the number of allowed threads with ulimit -u 1024 or something similar. Smaller values may also meet your needs. You can see the current values with ulimit -u.
  • Ask your hosting provider to raise the number of allowed processes or threads for your account.
  • Ask your hosting provider to provider a version of Git compiled without threads so that this isn't a problem, or compile one yourself.
  • Clone th repository elsewhere and copy it over using SFTP.
  • Find a different hosting provider whose limits are a little more reasonable.

Note that the problem is not free memory. With -m, free prints megabytes, and you have 2.5 GB free, which should be sufficient.

Upvotes: 1

Related Questions