On 5/30/17 10:10 AM, Sönke Ludwig wrote:

On Tue, 30 May 2017 09:54:19 -0400, Steven Schveighoffer wrote:

I just found that vibe.d crashes completely when a fiber tries to access
an OOB element of an array. This was a programing error and not a memory
corruption.

Other exceptions will just print an exception to the web page and
continue running. With a web server, it's kind of expected that any
error in a web page will not bring down the whole thing. Is there a way
to specifically catch RangeError and continue to run?

The big problem is that a RangeError that gets thrown within a call stack that contains nothrow functions can cause struct destructors on the stack to get skipped. So basically, unless it can be proven that no such construct exists, the process must be considered to be in a corrupted state after any Error has been thrown.

So really only the application can "safely" decide to catch RangeError in situations where it is clear that this won't cause any issues.

Ugh, good point.

So this means I basically have to manually turn range errors into
exceptions (i.e. convert builtin arrays to something that throws on
indexing), or somehow auto-restart the server on crashing. Annoying...

I'll drum up a discussion on the main forums about this. It doesn't seem
like something that is easy to solve, and seems like a harsh penalty to
pay for a simple invalid index.

-Steve