Skip to content

Commit d1f18a8

Browse files
authored
trace: update tracing-subscriber to 0.2.0-alpha.6 (#423)
Version 0.0.7 of `sharded-slab` contains a bug where, when the `remove` method is called with the index of a slot that is not being accessed concurrently, the slot is emptied but **not** placed on the free list. This issue meant that, under `tracing-subscriber`'s usage pattern, where slab entries are almost always uncontended when reused, allocated slab pages are almost never reused, resulting in unbounded slab growth over time (i.e. a memory leak). This commit updates `tracing-subscriber`' to version 0.2.0-alpha.6, which in turn bumps the `sharded-slab` dependency to v0.0.8, which includes commit hawkw/sharded-slab@dfdd7ae. That commit fixes this bug. I've empirically verified that, after running `linkerd2-proxy` under load with a global `trace` filter that enables a *lot* of spans, heap usage remains stable, and the characteristic stair-step heap growth pattern of doubling slab allocations doesn't occur. This indicates that freed slots are actually being reused, and (once fully warmed up), the slab will only grow when the number of active spans in the system increases. ![mem_plot](https://user-images.githubusercontent.com/2796466/73581369-cd859900-443d-11ea-8522-abeace03d745.png) Closes linkerd/linkerd2#3998 Signed-off-by: Eliza Weisman <[email protected]>
1 parent 52cc869 commit d1f18a8

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

Cargo.lock

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,10 @@ checksum = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
138138

139139
[[package]]
140140
name = "chrono"
141-
version = "0.4.9"
141+
version = "0.4.10"
142142
source = "registry+https://github.com/rust-lang/crates.io-index"
143-
checksum = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68"
143+
checksum = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01"
144144
dependencies = [
145-
"libc",
146145
"num-integer",
147146
"num-traits 0.2.6",
148147
"time",
@@ -1900,9 +1899,9 @@ dependencies = [
19001899

19011900
[[package]]
19021901
name = "sharded-slab"
1903-
version = "0.0.7"
1902+
version = "0.0.8"
19041903
source = "registry+https://github.com/rust-lang/crates.io-index"
1905-
checksum = "73ee8b66dea1777ef2c5f33ffeb90fd54afe43bb5c97bdaf82b521ad7c90a395"
1904+
checksum = "ae75d0445b5d3778c9da3d1f840faa16d0627c8607f78a74daf69e5b988c39a1"
19061905
dependencies = [
19071906
"lazy_static",
19081907
]
@@ -1919,6 +1918,12 @@ version = "0.6.10"
19191918
source = "registry+https://github.com/rust-lang/crates.io-index"
19201919
checksum = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
19211920

1921+
[[package]]
1922+
name = "smallvec"
1923+
version = "1.2.0"
1924+
source = "registry+https://github.com/rust-lang/crates.io-index"
1925+
checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc"
1926+
19221927
[[package]]
19231928
name = "socket2"
19241929
version = "0.3.5"
@@ -2560,9 +2565,9 @@ dependencies = [
25602565

25612566
[[package]]
25622567
name = "tracing-subscriber"
2563-
version = "0.2.0-alpha.4"
2568+
version = "0.2.0-alpha.6"
25642569
source = "registry+https://github.com/rust-lang/crates.io-index"
2565-
checksum = "51ec8cdf2ebadeefbb5a0fac5f3d54757415cdcc46f40542eaa0be56cd6d6361"
2570+
checksum = "8178ab65c2ae72cd431fcdb51e7317fb0b48d64599e66d52c7b64cd86ee5b482"
25662571
dependencies = [
25672572
"ansi_term",
25682573
"chrono",
@@ -2572,7 +2577,7 @@ dependencies = [
25722577
"serde",
25732578
"serde_json",
25742579
"sharded-slab",
2575-
"smallvec",
2580+
"smallvec 1.2.0",
25762581
"tracing-core",
25772582
"tracing-log",
25782583
"tracing-serde",
@@ -2590,7 +2595,7 @@ dependencies = [
25902595
"lazy_static",
25912596
"log",
25922597
"rand 0.6.5",
2593-
"smallvec",
2598+
"smallvec 0.6.10",
25942599
"socket2",
25952600
"tokio-executor",
25962601
"tokio-io",
@@ -2614,7 +2619,7 @@ dependencies = [
26142619
"log",
26152620
"lru-cache",
26162621
"resolv-conf",
2617-
"smallvec",
2622+
"smallvec 0.6.10",
26182623
"tokio",
26192624
"trust-dns-proto",
26202625
]

linkerd/app/core/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ tracing-futures = "0.1"
6363
tracing-log = "0.1"
6464

6565
[dependencies.tracing-subscriber]
66-
version = "0.2.0-alpha.4"
67-
# we don't need ANSI colors or `chrono` time formatting
66+
version = "0.2.0-alpha.6"
67+
# we don't need `chrono` time formatting
6868
default-features = false
69-
features = ["env-filter", "fmt", "smallvec", "tracing-log"]
69+
features = ["env-filter", "fmt", "smallvec", "tracing-log", "ansi"]
7070

7171
[target.'cfg(target_os = "linux")'.dependencies]
7272
libc = "0.2"

linkerd/app/core/src/trace.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ pub fn with_filter(filter: impl AsRef<str>) -> (Dispatch, LevelHandle) {
4141
let builder = FmtSubscriber::builder()
4242
.with_timer(Uptime { start_time })
4343
.with_env_filter(filter)
44-
.with_filter_reloading();
44+
.with_filter_reloading()
45+
.with_ansi(cfg!(test));
4546
let handle = LevelHandle {
4647
inner: builder.reload_handle(),
4748
};

linkerd/proxy/transport/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ libc = "0.2"
3636
[dev-dependencies]
3737
linkerd2-identity = { path = "../../identity", features = ["test-util"] }
3838
tower-util = "0.1"
39-
tracing-subscriber = "0.2.0-alpha.4"
39+
tracing-subscriber = "0.2.0-alpha.6"

0 commit comments

Comments
 (0)