# IPFS daemon doesn't add file after a while

**URL:** https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836
**Category:** Help
**Created:** [January 15, 2018, 3:52pm UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836 "2018-01-15T15:52:40Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![salux-x](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@salux-x](https://discuss.ipfs.tech/u/salux-x)
#### Post date: [January 15, 2018, 3:52pm UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/1 "2018-01-15T15:52:40Z")

</div>

I’m using ipfs to add files on some external events, it’s running on ubuntu linux server. After a while though I inevitably run into the problem: ipfs stops adding files altogether. It just hangs the add with no return and timeout. Nothing happenes at all.

What can I do to diagnose it?

I’m using the latest version.  
There’s no ERROR level log on the event. Will switch to INFO to see.

---

<div class="post-metadata">

### Author: ![Forrest](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/forrest/32/2539_2.png) [@Forrest](https://discuss.ipfs.tech/u/Forrest)
#### Post date: [January 15, 2018, 11:02pm UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/2 "2018-01-15T23:02:48Z")

</div>

Hi salux-x,  
Thanks for bringing this to our attention. Have few questions to narrow down the problem:

What is the size of the file/directory you are trying to add?  
What command are you running when adding?  
How far does the add operation make it before stalling?  
Are you able to run other commands when the add it hanging? Try running `ipfs id`, does that work?

You may also find the comments in this issue helpful, specifically:

> For now, when adding very large sets of data, its advisable to do so without the daemon running, or by using `ipfs add --local`. The issue is that you will clog up the DHT when adding such huge volumes of objects, and that slows everything else your node is doing down. It then also has the impact of consuming lots of extra memory.

Edit: Issue I forgot to link - [ipfs add hangs and stalls with large folders · Issue #3885 · ipfs/kubo · GitHub](https://github.com/ipfs/go-ipfs/issues/3885)

---

<div class="post-metadata">

### Author: ![redfish](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@redfish](https://discuss.ipfs.tech/u/redfish)
#### Post date: [January 15, 2018, 11:34pm UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/3 "2018-01-15T23:34:37Z")

</div>

> [@Forrest](#):
>
> For now, when adding very large sets of data, its advisable to do so without the daemon running, or by using ipfs add --local.

Btw, what does --local do exactly (I don’t see description in ipfs --help, ipfs add --help)? Will the blocks get advertised after the daemon restarts? Also, I thought that you would get ‘api not available’ error if you try to run any command while the daemon is not running (or am I misremembering)?

---

<div class="post-metadata">

### Author: ![Forrest](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/forrest/32/2539_2.png) [@Forrest](https://discuss.ipfs.tech/u/Forrest)
#### Post date: [January 16, 2018, 4:21am UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/4 "2018-01-16T04:21:58Z")

</div>

`--local` is a global command:

```auto
$ ipfs --help
...
 -L, --local bool - Run the command locally, instead of using the daemon.
...

```

However it probably doesn’t belong there see – [https://github.com/ipfs/go-ipfs/issues/4182](https://github.com/ipfs/go-ipfs/issues/4182)  
If you use the `--local` flag when adding, your daemon won’t broadcast the content to the network.

You are remembering correctly. However after staring my daemon then killing it I am able to run the add command and not receive the `api not available` error message, I think that might be dependent on some state with the api. What OS are you on?

---

<div class="post-metadata">

### Author: ![salux-x](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@salux-x](https://discuss.ipfs.tech/u/salux-x)
#### Post date: [January 16, 2018, 9:33am UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/5 "2018-01-16T09:33:40Z")

</div>

1. To answer the question about the initial problem:

- the file size I try adding isn’t relevant, it doesn’t add any file
- I try using bash like ‘ipfs add ./file.txt’ - it shows  
[===============================\>100%]file.txt  
and nothing more. it just stops and freezes like that.  
I tried using curl command with same effect.
- it happens after some time with no apparent reason

1. Now as I left server running overnight it shows me logs, I can see daemon running, but when adding file it says API not running. Also, id command works, but takes like 30 seconds to process.

---

<div class="post-metadata">

### Author: ![salux-x](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@salux-x](https://discuss.ipfs.tech/u/salux-x)
#### Post date: [January 17, 2018, 10:26am UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/6 "2018-01-17T10:26:19Z")

</div>

Now I get

Error: open /proc/self/status: too many open files

on

ipfs diag sys

---

<div class="post-metadata">

### Author: ![Forrest](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/forrest/32/2539_2.png) [@Forrest](https://discuss.ipfs.tech/u/Forrest)
#### Post date: [January 19, 2018, 1:01am UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/7 "2018-01-19T01:01:06Z")

</div>

I think I may still be missing some context, but here is my best guess at the problem - if the below does not lead to a resolution, please open an issue here: [https://github.com/ipfs/go-ipfs/issues](https://github.com/ipfs/go-ipfs/issues)

Problems such as the one described above can happen when adding large files to ipfs, this is because too many file descriptors get opened. This can sometimes be avoided by using the `--offline` flag when starting the daemon or the `--local` flag when running the add command. There is discussion on trouble shooting this issue here - [https://github.com/ipfs/go-ipfs/issues/3792](https://github.com/ipfs/go-ipfs/issues/3792) and here - [https://github.com/ipfs/go-ipfs/issues/3885](https://github.com/ipfs/go-ipfs/issues/3885).  
Once QUIC support is added this should happen less frequently.

---

<div class="post-metadata">

### Author: ![salux-x](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@salux-x](https://discuss.ipfs.tech/u/salux-x)
#### Post date: [January 19, 2018, 9:33am UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/8 "2018-01-19T09:33:59Z")

</div>

Offline option is not acceptable since I need files I add to be downloadable, and the key difference is that I don’t get error  
on opened descriptors (however I start using IPFS\_FD\_MAX=99999 and set ulimit to 65000), it just hangs on adding file, no error returned. I’ll post DEBUG log when adding file while problem is active.

for now script like this works for me:

> timeout 10 /etc/init.d/ipfs add /root/ipfs/spam.log  
> if [$? = 124] ; then  
> ps ax | grep ‘/etc/init.d/ipfs daemon’ | awk -F ’ ’ ‘{print $1}’ | xargs sudo kill -9

> ```
> echo 'kill success'
> 
> ```

> ```
> sleep 3
> 
> ```

> ```
> nohup sudo -u root IPFS_LOGGING=DEBUG IPFS_FD_MAX=10000 /etc/init.d/ipfs daemon --enable-pubsub-experiment > /var/log/rc.local2.log 2>&1 &  
> 
> ```

> end

which as you can see reacts on hanging file add and reboots ipfs

---

<div class="post-metadata">

### Author: ![S3bb1](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/s3bb1/32/998_2.png) [@S3bb1](https://discuss.ipfs.tech/u/S3bb1)
#### Post date: [March 8, 2018, 10:48am UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/9 "2018-03-08T10:48:44Z")

</div>

Hi there,

we’ve currently ran into the same problem … we don’t have any idea why this is happening, the debug logs also say nothing error related… all normal … it suddenly stops adding files.

---

<div class="post-metadata">

### Author: ![rayj](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@rayj](https://discuss.ipfs.tech/u/rayj)
#### Post date: [November 15, 2019, 7:56pm UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/10 "2019-11-15T19:56:29Z")

</div>

Did anyone ever solve this? I’m seeing this issue as well D: And we see it in adding empty files, files with 1B of data, etc.

What’s the difference between `free_space` and `total_space` in the ipfs sys diag? It seems like these numbers always differ by `16,777,216` which has some incrementing issues if it’s a float32.

> <https://stackoverflow.com/questions/12596695/why-does-a-float-variable-stop-incrementing-at-16777216-in-c>

---

<div class="post-metadata">

### Author: ![stebalien](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/stebalien/32/156_2.png) [@stebalien](https://discuss.ipfs.tech/u/stebalien)
#### Post date: [November 16, 2019, 2:20am UTC](https://discuss.ipfs.tech/t/ipfs-daemon-doesnt-add-file-after-a-while/1836/11 "2019-11-16T02:20:22Z")

</div>

> What’s the difference between `free_space` and `total_space` in the ipfs sys diag? It seems like these numbers always differ by `16,777,216` which has some incrementing issues if it’s a float32.

Free space is the amount fo free space. Total is the total space. These are both uint64s and are returned by `syscall.Statfs`.

> Did anyone ever solve this? I’m seeing this issue as well D: And we see it in adding empty files, files with 1B of data, etc.

It could be anything. You could be out of disk space, you could be running into [Pinning is slow when there are many pins · Issue #5221 · ipfs/kubo · GitHub](https://github.com/ipfs/go-ipfs/issues/5221).
