Priority: Major - P3
Affects Version/s: None
Fix Version/s: Backlog
Currently our internal event handler method ('eventv') creates a formatted message in a stack buffer. This is to ensure we can reliably produce messages, where allocating a buffer for the message could end up failing.
In the case we overrun the stack buffer size, the resulting message gets truncated (+ we print an additional message indicating the message was truncated).
In this ticket, we ideally want to investigate possible approaches where the message doesn't get truncated. Ideally a strategy could look like:
- Start with a stack buffer.
- If we overflow the stack buffer, switch to allocating a heap buffer to fit the message.
- If allocation fails, fall back to the previous buffer and accept message truncation.
The above strategy is possibly an over simplification of the problem space, given the dynamic nature of the JSON string construction (recently added). Though hopefully this ticket will investigate a feasible strategy.
Definition of Done
- Investigate and spike approach.