Commit 265ee48
committed
Fix memory leak by limiting internal message queue size
This commit addresses GitHub issue #61 where memory usage keeps increasing
and garbage collection fails, eventually causing node crashes after several days.
Root Cause:
The syslog4j library queues messages internally with no limit by default when
using TCP/SSL protocols. Under high message throughput, this causes unbounded
memory growth leading to OOM errors.
Solution:
1. Added maxQueueSize configuration parameter (default: 500 messages)
2. Set maxQueueSize on all syslog config objects (UDP/TCP/SSL)
3. Made the parameter user-configurable through Graylog UI
The conservative default of 500 prevents memory leaks while still allowing
reasonable buffering. Users experiencing high throughput can tune this value
based on their needs, but should avoid unlimited queuing (-1).
When the queue is full, the plugin will block until space is available,
providing natural backpressure instead of consuming all available memory.
Configuration:
- Default: 500 messages
- Configurable via "Maximum queue size" field in output configuration
- Set to -1 for unlimited (not recommended, will cause OOM)
Fixes #61
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 7401ea5 commit 265ee48
File tree
1 file changed
+20
-0
lines changed- src/main/java/com/wizecore/graylog2/plugin
1 file changed
+20
-0
lines changedLines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
146 | 164 | | |
147 | 165 | | |
148 | 166 | | |
| |||
320 | 338 | | |
321 | 339 | | |
322 | 340 | | |
| 341 | + | |
| 342 | + | |
323 | 343 | | |
324 | 344 | | |
325 | 345 | | |
| |||
0 commit comments