zyazhb / File-monitor

File monitor in golang.
0 stars 0 forks source link

在测试fanotify时出现panic: unable to open database file: too many open files #33

Open zyazhb opened 3 years ago

zyazhb commented 3 years ago

server log: 2021/01/27 10:04:35 /root/ZYA/File-monitor/server/model/RpcDbControl.go:57 [error] failed to initialize database, got error unable to open database file: too many open files panic: unable to open database file: too many open files

agent log: 2021/01/27 10:04:35 ReDial RPC Server Error: dial tcp 127.0.0.1:8083: connect: connection refused

猜测原因为每个用户最多可以创建的fanotify 达到数量上限

zyazhb commented 3 years ago
[GIN] 2021/03/10 - 18:26:57 | 500 |       846.6µs |             ::1 | GET      "/getresult/299"

2021/03/10 18:27:26 /root/ZYA/File-monitor/server/model/RpcDbControl.go:37
[error] failed to initialize database, got error unable to open database file: too many open files

2021/03/10 18:27:26 [Recovery] 2021/03/10 - 18:27:26 panic recovered:
GET /getresult/299 HTTP/1.1
Host: localhost:8080
Accept: application/json, text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Connection: keep-alive
Cookie: _ga=GA1.1.628878689.1615190610; _ga_9VK0B43EQ3=GS1.1.1615190610.1.1.1615190715.0; sessionid=MTYxNTM2MzY4MnxEdi1CQkFFQ180SUFBUkFCRUFBQVh2LUNBQU1HYzNSeWFXNW5EQVlBQkhKdmJHVURhVzUwQkFJQUFBWnpkSEpwYm1jTUJRQURkV2xrQTJsdWRBUUNBQUlHYzNSeWFXNW5EQXNBQ1d4dloybHVkWE5sY2daemRISnBibWNNRUFBT1lXUnRhVzVBYm5Wc2JDNWpiMjA9fOv3t_vgA0f7uNoMrzo0LbqFeKt3tbwSqomk-RGqWx9L
Dnt: 1
Referer: http://localhost:8080/manager
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36
X-Requested-With: XMLHttpRequest

unable to open database file: too many open files
/root/ZYA/File-monitor/server/model/RpcDbControl.go:39 (0x9b566b)
/root/ZYA/File-monitor/server/model/common.go:38 (0x9b91b2)
/root/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x99e7da)
/root/go/pkg/mod/github.com/gin-contrib/sessions@v0.0.3/sessions.go:52 (0x9b4e85)
/root/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x99e7da)
/root/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/recovery.go:83 (0x9b27c4)
/root/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x99e7da)
/root/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/logger.go:241 (0x9b18c4)
/root/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x99e7da)
/root/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:409 (0x9a8b19)
/root/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:367 (0x9a820c)
/usr/lib/go-1.15/src/net/http/server.go:2843 (0x7ce5c2)
/usr/lib/go-1.15/src/net/http/server.go:1925 (0x7c9ccc)
/usr/lib/go-1.15/src/runtime/asm_amd64.s:1374 (0x472620)