Skip to content

Commit 697979e

Browse files
committed
doc: add session refcounting subsystem graph
1 parent 4b310da commit 697979e

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

doc/pages/internals/session_refcounting.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,61 @@
22

33
# Session Reference Counting
44

5+
6+
@dot
7+
digraph session_refcounting {
8+
graph [
9+
ranksep=0.8,
10+
nodesep=0.8,
11+
splines=true
12+
];
13+
14+
edge [
15+
minlen=2
16+
];
17+
rankdir=TB;
18+
compound=true;
19+
node [shape=box, fontsize=10];
20+
21+
subgraph cluster_session_refcounting_subsystem {
22+
label="session refcounting subsystem";
23+
style=rounded;
24+
25+
fork [label="tp/sched/sched_process_fork"];
26+
exit [label="tp/sched/sched_process_exit"];
27+
exit_setsid [label="tp/syscalls/sys_exit_setsid"]
28+
enter_setsid [label="tp/syscalls/sys_enter_setsid"]
29+
30+
refcounting_map_old_sessionid [label="refcounting_map_old_sessionid"]
31+
}
32+
33+
subgraph cluster_keyvan {
34+
label="keyvan";
35+
style=rounded;
36+
37+
users_having_sid_verdict_map [label="users_having_sid_verdict_map"];
38+
39+
verdict_map_session [label="verdict_map_session"];
40+
41+
refcounting_map_session [label="refcounting_map_session"];
42+
43+
}
44+
45+
users_having_sid_verdict_map -> fork;
46+
fork -> refcounting_map_session;
47+
48+
users_having_sid_verdict_map -> exit_setsid;
49+
exit_setsid -> refcounting_map_session;
50+
refcounting_map_old_sessionid -> exit_setsid;
51+
exit_setsid -> verdict_map_session;
52+
53+
enter_setsid -> refcounting_map_old_sessionid;
54+
55+
exit -> refcounting_map_session;
56+
exit -> verdict_map_session;
57+
}
58+
@enddot
59+
560
Per-session authentication checkers will create map elements on a per-session basis, this creates the need to clean them up after they are not used. The session reference counting subsystem keeps track of new sessions created with `setsid`, and when reference count of a session hits zero it start cleaning up map elements associated with them.
661

762
Session reference count increments when the process is forked, and is decremented when the process exists or process calls `setsid`, leaving it's current session.

0 commit comments

Comments
 (0)