# Too many open files on NetBSD - where to start?

**URL:** https://forum.syncthing.net/t/too-many-open-files-on-netbsd-where-to-start/21934
**Category:** Support
**Created:** [April 13, 2024, 2:04am UTC](https://forum.syncthing.net/t/too-many-open-files-on-netbsd-where-to-start/21934 "2024-04-13T02:04:47Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lparkes](https://forum.syncthing.net/user_avatar/forum.syncthing.net/lparkes/32/16358_2.png) [@lparkes](https://forum.syncthing.net/u/lparkes)
#### Post date: [April 13, 2024, 2:04am UTC](https://forum.syncthing.net/t/too-many-open-files-on-netbsd-where-to-start/21934/1 "2024-04-13T02:04:48Z")

</div>

Kia ora koutou, I’m running syncthing v1.27.6 “Gold Grasshopper” (go1.22.2 netbsd-amd64) and I can see that it seems to be holding open all the files in my (so far only one) shared folder open. The syncthing process has 2654 files open when trying to share a folder heirarchy with 2361 files in it.

The Linux version I’m running on Arch Linux (syncthing v1.27.6 “Gold Grasshopper” (go1.22.2 linux-amd64) syncthing@archlinux) has 56 files open when sharing a folder heirarchy with 3629 files.

Using ktrace I can see a whole lot of files getting opened, but I never see them get closed.

I’ve doena bit of Go programming over the years, but this program is a bit bigger than I’m used to. If someone could point me towards somewhere to look, I’d appreciate it.

Ngā mihi, Lloyd

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [April 13, 2024, 6:20am UTC](https://forum.syncthing.net/t/too-many-open-files-on-netbsd-where-to-start/21934/2 "2024-04-13T06:20:09Z")

</div>

You don’t say which files are open, but on the assumption that it’s the files being served: we open the file, read one block, then close it again: [syncthing/lib/model/model.go at 79ae24df7688c37a7a897218c87bff412a887b9d · syncthing/syncthing · GitHub](https://github.com/syncthing/syncthing/blob/79ae24df7688c37a7a897218c87bff412a887b9d/lib/model/model.go#L3345)

This doesn’t differ between platforms…

---

<div class="post-metadata">

### Author: ![lparkes](https://forum.syncthing.net/user_avatar/forum.syncthing.net/lparkes/32/16358_2.png) [@lparkes](https://forum.syncthing.net/u/lparkes)
#### Post date: [April 13, 2024, 10:26pm UTC](https://forum.syncthing.net/t/too-many-open-files-on-netbsd-where-to-start/21934/3 "2024-04-13T22:26:55Z")

</div>

It is the files being served. I can see that in the ktrace output.

Hmm. I don’t recall seeing the files getting read either, so that’s where I’ll look first.

I’m not really expecting much code other than the obvious inotify/kqueue stuff to differ between Linux and NetBSD. I’m open to possibility that the problem could exist anywhere, not just core syncthing code.

Ngā mihi, Lloyd

---

<div class="post-metadata">

### Author: ![lparkes](https://forum.syncthing.net/user_avatar/forum.syncthing.net/lparkes/32/16358_2.png) [@lparkes](https://forum.syncthing.net/u/lparkes)
#### Post date: [April 14, 2024, 12:39am UTC](https://forum.syncthing.net/t/too-many-open-files-on-netbsd-where-to-start/21934/4 "2024-04-14T00:39:36Z")

</div>

Aaaand it’s kqueue. The BSD kqueue system requires the files being monitored to be held open. Oh well. Time to increase that system’s file limits I guess.

Ngā mihi, Lloyd

---

<div class="post-metadata">

### Author: ![system](https://forum-uploads.syncthingcdn.net/original/2X/0/0b50e0a202b22ae6a67190759e8c868805b8ed9f.png) [@system](https://forum.syncthing.net/u/system)
#### Post date: [May 14, 2024, 12:40am UTC](https://forum.syncthing.net/t/too-many-open-files-on-netbsd-where-to-start/21934/5 "2024-05-14T00:40:08Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
