We run into this when trying to warn(uneval(g_CivInfo)) or some entity simstate.
Should we support extremely long messages or just show the N first characters and possibly an additional warning about a too long message?
I vote for the second option, we don't really need to support these long messages (just write them to some log if needed).
At least we should do anything, but not crashing.
The limit of 16366 chars in warning comes from a limit of 16384 in debug_printf.
This limit already was changed from 4096 to 16384 in rP10491.
Leaning towards that too.
While at it:
The only way I ran into this segfault was by doing warn(uneval(hugeObject)).
D401 does exactly that if the object couldn't be converted, do we want that?
A power of 2 greater than the too short 4096 without being completely excessive?
(I'm leaning towards having D401 abandoned, but I don't want to be rude and maybe I didn't discover the use case yet)
Basically what elexis said. There was some hwdetect work done back then (just checked the logs, no specific mention of that). As to why that should be as small as possible is because that is on the stack, and stack sizes are small, and if we end up running into some ENSURE or similar in a deep callstack we might be short on available stack. That and nobody needed more. Yes crashing in that case is wrong, we should truncate, though I seem to recall a diff (or commit?) that attempted to limit the length of things passed to one of the debug functions.