Commit 668358c
committed
log_event_decoder: improve robustness for invalid group markers
Enhance the log event decoder to handle corrupted group markers more
robustly while preserving data integrity:
1. **Preserve group state on invalid markers**: Invalid group markers
(negative timestamps not -1 or -2) no longer clear the active group
state. This prevents data loss when corruption occurs mid-group,
ensuring subsequent normal logs retain their group metadata.
2. **Add recursion depth guard**: Implement a safety limit (1000) to
prevent potential stack overflow from excessive consecutive group
markers or corruption. The decoder returns an error if the limit
is reached.
3. **Add debug logging**: Log invalid group marker timestamps at debug
level to aid in troubleshooting data corruption issues without
cluttering normal operation logs.
4. **Improve documentation**: Enhanced comments explaining the negative
timestamp contract and the improved error handling behavior.
These changes make the decoder more resilient to data corruption while
maintaining backward compatibility and ensuring data integrity is
preserved even when encountering invalid group markers.
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>1 parent 0e6513f commit 668358c
3 files changed
Lines changed: 53 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
36 | 47 | | |
37 | 48 | | |
38 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| 80 | + | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
| |||
309 | 313 | | |
310 | 314 | | |
311 | 315 | | |
| 316 | + | |
312 | 317 | | |
313 | 318 | | |
314 | 319 | | |
| |||
347 | 352 | | |
348 | 353 | | |
349 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
350 | 363 | | |
351 | 364 | | |
352 | 365 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
358 | 381 | | |
359 | 382 | | |
360 | 383 | | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
366 | 392 | | |
367 | 393 | | |
368 | 394 | | |
| |||
411 | 437 | | |
412 | 438 | | |
413 | 439 | | |
| 440 | + | |
414 | 441 | | |
| 442 | + | |
415 | 443 | | |
416 | | - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
417 | 447 | | |
418 | 448 | | |
419 | 449 | | |
| |||
0 commit comments