Skip to content

Commit 19b34f4

Browse files
committed
Patch wireguard-go for low memory pods
Patch wireguard-go to workaround ongoing issue related to pods with low memory limits OOMing due to wireguard-go buffer/gc issues. Related to WireGuard/wireguard-go#69
1 parent 20fa8f0 commit 19b34f4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ RUN apt-get update && \
1212
rm -rf /var/lib/apt/lists/* /var/log/* && \
1313
mkdir ${PREFIX}
1414

15+
ADD wg-buffers.patch /
16+
1517
RUN git clone https://git.zx2c4.com/wireguard-go && \
1618
cd wireguard-go && \
1719
git checkout $wg_go_tag && \
20+
git apply /wg-buffers.patch && \
1821
make && \
1922
make install
2023

wg-buffers.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
diff --git a/device/queueconstants_default.go b/device/queueconstants_default.go
2+
index b061185..d15780c 100644
3+
--- a/device/queueconstants_default.go
4+
+++ b/device/queueconstants_default.go
5+
@@ -15,5 +15,5 @@ const (
6+
QueueInboundSize = 1024
7+
QueueHandshakeSize = 1024
8+
MaxSegmentSize = (1 << 16) - 1 // largest possible UDP datagram
9+
- PreallocatedBuffersPerPool = 0 // Disable and allow for infinite memory growth
10+
+ PreallocatedBuffersPerPool = 4096
11+
)

0 commit comments

Comments
 (0)