[MDEV-30815] Printing a stack trace leaks file descriptors. Created: 2023-03-09 Updated: 2023-07-16 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Debug |
| Affects Version/s: | 10.5 |
| Fix Version/s: | 10.5 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Rex Johnston | Assignee: | Rex Johnston |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In situations where mariadbd emits a lot of stack traces it can run out of file descriptors. Each time the pipe to the external utility addr2line is opened, those file descriptor are never closed. |
| Comments |
| Comment by Rex Johnston [ 2023-03-15 ] | ||||||
|
Hi Marko, do we want this? Thanks, Rex | ||||||
| Comment by Marko Mäkelä [ 2023-03-20 ] | ||||||
|
I think that this would be best reviewed by someone who has worked on this code earlier. The main thing to ensure is that this will not cause any regression on any platform. Unfortunately, the AIX build on 10.5 was broken by something related to | ||||||
| Comment by Sergei Golubchik [ 2023-03-29 ] | ||||||
|
I don't think there should be many or "each time the pipe is opened", add2line should be executed only once, from the crash handler. If we want to have a backtracer that can be invoked many times run-time without aborting the server, we'd likely prefer something more lightweight. | ||||||
| Comment by Rex Johnston [ 2023-03-30 ] | ||||||
|
I've just downloaded and looked at libbacktrace. License is a permissive BSD and a call like this
produces data like this
| ||||||
| Comment by Vicențiu Ciorbaru [ 2023-04-18 ] | ||||||
|
Johnston see https://github.com/MariaDB/server/pull/2536#issuecomment-1512428174 Please properly update this MDEV so I can make some sense of the actual problem and what your proposed solution is. |