On Wed, 04 Sep 2013 15:39:37 GMT, Craig Dillabaugh wrote:

On Tue, 03 Sep 2013 18:40:21 GMT, Craig Dillabaugh wrote:

On Tue, 03 Sep 2013 19:18:42 +0200, Sönke Ludwig wrote:

Am 03.09.2013 18:19, schrieb Craig Dillabaugh:

Hello,
I have a small server set up to serve image tiles as raw binary files. The 'app' consists of a HTML canvas page which uses an XMLHttpRequest() to request tiles from the server, which serves the tiles as raw data, which is then displayed on the canvas.

The whole app (minus the canvas2.html file) can be found here:

http://dpaste.com/hold/1364821/

Initially, it was working and I was able to serve and display tiles on my Canvas. Now my application crashes whenever I attempt to access a tile. The output from DUB is as follows:

(...)

I have no idea what the cause of this error is. Any advice on how to track this down would be appreciated.

Craig

Try doing "dub build" followed by "gdb ./name-of-app", enter "r" to run
and then, after it has crashed, "bt" to get a stack trace. Hopefully
that gives enough information to find the cause.

I get the following stack trace. It seems like the problem is with passing the request data to the getTile() function.
I am not really sure how to interpret the stack trace, but it seems odd that the 'this' pointer (at #1) points to the
same address passed to req in #0, which isn't what I would expect, as I assume 'this' is the function pointer to
app.getTile().

Stack trace:
clips

Craig

So I have identified the line of code causing the error, but I am no less perplexed than before.

It is the line:

	ubyte[tile_size * tile_size] data;

If tile_size >= 246 (total 60516 bytes) then the program crashes with error code -11, otherwise it seems to run fine.
Since this is a static array, and D has a limit on static array sizes, I thought that might be the problem, but D allows static arrays of size up to 16Mb, and this is clearly much smaller. Also, it should have generated a compile time error.

Is it perhaps a fiber problem. Maybe fibers don't allow such large static data structures? Any ideas?

Craig

So, if I replace:

ubyte[tile_size * tile_size] data;

with

ubyte[] data;
data.length = tile_size * tile_size;

it runs fine. So it is certainly something with the static array. Anyway, at least I have a work around now.