简体   繁体   English

不可预测的文件描述符泄漏

[英]Unpredictable File Descriptor leak

Okay, so I'm investigating which seems to be an FD leak. 好的,所以我正在调查哪个似乎是FD泄漏。

It's a linux CppCms application written in C++11, I test it with a tools that send approximately 250 requests/seconds. 这是一个用C ++ 11编写的linux CppCms应用程序,我使用发送大约250次请求/秒的工具对其进行了测试。

The tests is during 30 minutes, and sometimes I get the lighttpd (server.c.1446) [note] sockets disabled, out-of-fds error. 测试是在30分钟内进行的,有时我(server.c.1446) [note] sockets disabled, out-of-fds了lighttpd (server.c.1446) [note] sockets disabled, out-of-fds错误。

I've started investigating FDs using watch "sudo ls /proc/<lighttpd>/fd/ | wc -l; echo /;sudo ls /proc/<myApp>/fd/ | wc -l;echo /; sysctl fs.file-nr" 我已经开始使用watch "sudo ls /proc/<lighttpd>/fd/ | wc -l; echo /;sudo ls /proc/<myApp>/fd/ | wc -l;echo /; sysctl fs.file-nr"

Results seems to say that everything is fine until it's not. 结果似乎表明一切都很好,直到事实并非如此。 FDs are stable (50 - 100) and randomly get up to the lighttpd max-fd number. FD稳定(50-100),并且随机达到lighttpd max-fd数。 If my application was involved, I think it will happened earlier (not after 200000 successful requests) 如果涉及到我的申请,我认为它会更早发生(而不是在200000成功请求之后)

I've used valgrind to try to see anything and I've found this : 我用valgrind尝试看任何东西,发现了:

==5647== Open AF_UNIX socket 6: <unknown>
==5647==    at 0x8E379EA: socketpair (syscall-template.S:84)
==5647==    by 0x97F8001: booster::aio::socket_pair(booster::aio::stream_socket&, booster::aio::stream_socket&) (stream_socket.cpp:570)
==5647==    by 0x7312766: cppcms::service::setup_exit_handling() (service.cpp:378)
==5647==    by 0x73135C7: cppcms::service::run() (service.cpp:572)
==5647==    by 0x43F56E: MainMngr::runServer() (mainmngr.cpp:46)
==5647==    by 0x443A95: main (main.cpp:22)
==5647== 
==5647== Open AF_UNIX socket 5: <unknown>
==5647==    at 0x8E379EA: socketpair (syscall-template.S:84)
==5647==    by 0x97F8001: booster::aio::socket_pair(booster::aio::stream_socket&, booster::aio::stream_socket&) (stream_socket.cpp:570)
==5647==    by 0x7312766: cppcms::service::setup_exit_handling() (service.cpp:378)
==5647==    by 0x73135C7: cppcms::service::run() (service.cpp:572)
==5647==    by 0x43F56E: MainMngr::runServer() (mainmngr.cpp:46)
==5647==    by 0x443A95: main (main.cpp:22)

I'm not able to say if it's a real file descriptor leak, but it seems so. 我不能说这是否是真正的文件描述符泄漏,但似乎是这样。

Does my code have a problem ? 我的代码有问题吗? Does CppCms have a problem ? CppCms是否有问题? Have you ever encounter such problem ? 你遇到过这样的问题吗? Have you any tips to detect who is incrementing the file descriptor handle from 100 to 8000 ? 您有什么技巧来检测谁将文件描述符句柄从100增加到8000?

Sorry. 抱歉。 There is a regression in lighttpd 1.4.43 with mod_cgi and CGI POST requests. lighttpd 1.4.43中使用mod_cgi和CGI POST请求进行了回归。 Description of problem and patch is available in https://redmine.lighttpd.net/issues/2771 问题和补丁的描述可在https://redmine.lighttpd.net/issues/2771中找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM