Perhaps this is unavoidable behavior, but with diet template containing reference to a null object, such as:

- if(!error.exception)
    p Exception:
        |= error.exception.toString()

I get the server to crash with "Segmentation Fault". Of course, this is avoidable in this case by removing the "!" - but that is what I'm demonstrating here.

My real question is: should this be caught/detected/handled somehow and not allow the entire web server to die? I understand that it can't be prevented at compile time, but it still seems dangerous.

On the other hand, I'm not 100% sure it is a null-dereference that is causing the error because it appears that the HTTP response is created and bytes written to TCP. See this trace level console logging:

[44880099:448D2A99 trc] Got request header.
[44880099:448D2A99 trc] persist: true
[44880099:448D2A99 trc] handle request (body 0)
[44880099:448D2A99 dbg] Match tree has 3 nodes, 1 terminals
[44880099:448D2A99 dbg] no route match: GET /jasdhfkjahsd
[44880099:448D2A99 dia] No response written for /jasdhfkjahsd
[44880099:448D2A99 trc] ---------------------
[44880099:448D2A99 trc] HTTP server response:
[44880099:448D2A99 trc] ---------------------
[44880099:448D2A99 trc] HTTP/1.1 404 Not Found
[44880099:448D2A99 trc] Server: vibe.d/0.7.24
[44880099:448D2A99 trc] Date: Fri, 18 Sep 2015 17:36:26 GMT
[44880099:448D2A99 trc] Keep-Alive: timeout=10
[44880099:448D2A99 trc] Content-Type: text/html; charset=UTF-8
[44880099:448D2A99 trc] Transfer-Encoding: chunked
[44880099:448D2A99 trc] ---------------------
[44880099:448D2A99 trc] write enter
[44880099:448D2A99 trc] Acquire Writer
[44880099:448D2A99 trc] Check Connected
[44880099:448D2A99 trc] TCP write with 178 bytes called
[44880099:448D2A99 trc] Check Connected
[44880099:448D2A99 trc] Release Writer
[44880099:448D2A99 trc] Flush
[44880099:448D2A99 trc] Acquire Writer
[44880099:448D2A99 trc] Check Connected
[44880099:448D2A99 trc] Release Writer
Segmentation fault

I compared a normal page load and it appears to do 4 more "TCP write with X bytes called" after this. The line that would have appeared at the "Segmentation fault" line is "write enter" followed by an Acquire, Check and TCP write of 4 bytes.

So, perhaps the issue is happening in the TCP connection somehow, but it's still affected by the diet template since I can either remove the whole exception part of remove the "!" and it works as normal.

Details in case it helps:
DMD 2.0.068.1 on Win10 x64 using VS2015 linker and CRT
dub build --arch=x86_64
vibe.d 0.7.24
memutils 0.4.1
libasync 0.7.5