storj-archived/kfs

Used space query keeps 1028 files open

Closed this issue · 2 comments

Package Versions

└─┬ storjshare-daemon@2.4.3
  └─┬ storj-lib@6.2.0
    └── kfs@3.1.1

Replace the values below using the output from node --version.

v6.10.0

Expected Behavior

kfs contains 257 leveldb and each leveldb needs at least 4 open files. LOG, LOCK, MANIFEST and one *.log file. I would expect that only the used leveldbs are open.

Actual Behavior

Because of the used space query all leveldbs and all 1028 files are open and never closed.

root@storj:~# ls -l /proc/416/fd | grep 'storjshare' | wc -l
1028

I disabled the used space query: https://github.com/littleskunk/core/blob/debug/lib/storage/adapters/embedded.js#L171-L173

root@storj:~# ls -l /proc/416/fd | grep 'storjshare' | wc -l
4

Leveldbs are never closed. Even hours after the first download channel is timed out (was never used) the leveldb is still open.

root@storj:~# grep 'download\|upload' .storjshare/storjshare/logs/188071ba7cfd974a9e47b59e24b0737ebf845db3.log
{"level":"info","message":"authorizing download data channel for 144d1265baf0908fe6c6bd272c701aac7811e3e4","timestamp":"2017-02-24T10:58:45.947Z"}
{"level":"info","message":"authorizing download data channel for 1e85d472e5e88a37d9bd9f3780891d8e532d4832","timestamp":"2017-02-24T11:17:34.940Z"}
{"level":"info","message":"authorizing download data channel for 1919783206b265ed681868ebc024777d083e9d93","timestamp":"2017-02-24T11:21:10.332Z"}
{"level":"info","message":"authorizing download data channel for 17cbc6773e573b28489412753447e4e9fe16b76b","timestamp":"2017-02-24T12:02:56.419Z"}
{"level":"info","message":"authorizing download data channel for 1e85d472e5e88a37d9bd9f3780891d8e532d4832","timestamp":"2017-02-24T12:32:03.750Z"}
{"level":"info","message":"authorizing download data channel for 1919783206b265ed681868ebc024777d083e9d93","timestamp":"2017-02-24T13:14:13.817Z"}
{"level":"info","message":"authorizing download data channel for 17cbc6773e573b28489412753447e4e9fe16b76b","timestamp":"2017-02-24T13:15:26.548Z"}
root@storj:~# ls -l /proc/416/fd | grep 'storjshare' | wc -l
32