https://bugs.kde.org/show_bug.cgi?id=479524

--- Comment #1 from Christopher Vollick <k...@psycoti.ca> ---
Just coming back to this, I ran with `strace` and it lead me in an interesting
direction.

If I only filter out the place where it reads the proxy files, and limit it to
the `openat` and `close` calls, then I get a pattern that looks like:

> 21:16:09 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov", O_RDONLY) = 
> 40<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov", O_RDONLY) = 
> 51<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov", O_RDONLY) = 
> 52<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>
> 21:16:10 close(40<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>) = 0
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov", O_RDONLY) = 
> 40<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov", O_RDONLY) = 
> 53<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov", O_RDONLY) = 
> 54<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>
> 21:16:10 close(40<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>) = 0
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov", O_RDONLY) = 
> 40<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov", O_RDONLY) = 
> 55<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov", O_RDONLY) = 
> 56<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>
> 21:16:10 close(40<DIR/proxy/275889bce023e68fa2d79a6cdd0dfa12.mov>) = 0
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov", O_RDONLY) = 
> 40<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov", O_RDONLY) = 
> 57<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov", O_RDONLY) = 
> 58<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>
> 21:16:10 close(40<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>) = 0
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov", O_RDONLY) = 
> 40<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov", O_RDONLY) = 
> 59<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov", O_RDONLY) = 
> 60<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>
> 21:16:10 close(40<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>) = 0
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov", O_RDONLY) = 
> 40<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov", O_RDONLY) = 
> 61<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov", O_RDONLY) = 
> 62<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>
> 21:16:10 close(40<DIR/proxy/ef1a7fc6342d024a79cf6dd2c983b322.mov>) = 0
> 21:16:10 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/325f091b51389dc5389f7ee5975557ad.mov", O_RDONLY) = 
> 40<DIR/proxy/325f091b51389dc5389f7ee5975557ad.mov>

Where the assigned fd for an "open" comes after the `=`, and inside the parens
for close.
So anyway, what this shows is that we have some fd (40) which we are managing
properly. We open the file, do something with it, then close it. Then open the
next one. It's a little bit weird that we're opening each proxy file 3 times,
but in the end it's fine. But for each of those, we're also opening the file
two more times, and these ones we never ever close. There are 1905 lines in my
log of proxies here, and we only ever close fd 40.

So what this means is that for each proxy file, we open it 3 times "properly",
and then 6 more times, and we leak those 6. Then it moves on to the next file,
and leaks 6 more of them. So if I have around 359 clips, and assuming each has
a proxy, I'd need a file limit of 2154 to be able to open the project.

And just to show that the pattern holds, this is the end of the log:

> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov", O_RDONLY) = 
> 40<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov", O_RDONLY) = 
> 1011<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov", O_RDONLY) = 
> 1012<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>
> 21:16:16 close(40<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>) = 0
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov", O_RDONLY) = 
> 40<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov", O_RDONLY) = 
> 1013<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov", O_RDONLY) = 
> 1014<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>
> 21:16:16 close(40<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>) = 0
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov", O_RDONLY) = 
> 40<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov", O_RDONLY) = 
> 1015<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov", O_RDONLY) = 
> 1016<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>
> 21:16:16 close(40<DIR/proxy/13e1d677ea9d2fcaf8a9cbfddb32f3fe.mov>) = 0
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov", O_RDONLY) = 
> 40<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov", O_RDONLY) = 
> 1017<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov", O_RDONLY) = 
> 1018<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>
> 21:16:16 close(40<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>) = 0
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov", O_RDONLY) = 
> 40<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov", O_RDONLY) = 
> 1019<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov", O_RDONLY) = 
> 1020<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>
> 21:16:16 close(40<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>) = 0
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov", O_RDONLY) = 
> 40<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov", O_RDONLY) = 
> 1021<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov", O_RDONLY) = 
> 1022<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>
> 21:16:16 close(40<DIR/proxy/269913d959ad0e7533e0450c1c305fef.mov>) = 0
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/55019c3613525108850e35bab8b8803b.mov", O_RDONLY) = 
> 40<DIR/proxy/55019c3613525108850e35bab8b8803b.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/55019c3613525108850e35bab8b8803b.mov", O_RDONLY) = 
> 1023<DIR/proxy/55019c3613525108850e35bab8b8803b.mov>
> 21:16:16 openat(AT_FDCWD<DIR>, 
> "DIR/proxy/55019c3613525108850e35bab8b8803b.mov", O_RDONLY) = -1 EMFILE (Too 
> many open files)

So it's still handling fd 40 properly, it's still in blocks of 3, and it's
still accumulating fds until eventually at 1023 it returns a failure, which
triggers a segfault and crashes the program.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to