Project

General

Profile

Actions

Bug #1245

closed

file descriptor statedump should iterate over all processes/threads, not just processes

Added by Mathieu Desnoyers over 4 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
03/10/2020
Due date:
% Done:

100%

Estimated time:

Description

If we look at the output of lsof, we observe that it prints file descriptors for all processes/threads, not just processes.

Currently the LTTng-modules statedump simply iterates over all processes in the system and assumes all threads share the same file descriptor table, which is only true if threads were created with clone CLONE_FILES.

Directly invoking clone without the CLONE_FILES creates threads which belong to the same process, but have their own file descriptor table.

Therefore, model-wise, we cannot assume that all threads in a process have the same fd table content.

Fixing this would involve changing the statedump to iterate on all processes/threads, and dump the fd tables for each tid.

Actions #1

Updated by Mathieu Desnoyers over 4 years ago

In order to "known" whether fd tables are shared or not across threads, the analysis can use the clone CLONE_FILES flags for newly created threads. However, for pre-existing threads, it is not straightforward.

We would need to dump the address of p->files (pointer to the thread's struct files_struct) into the trace to allow figuring out if the fd tables are shared or not.

Actions #2

Updated by Mathieu Desnoyers over 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF