My vibe-d test app is crashing on Windows

ShadoLight ettienne.gilbert at gmail.com
Mon Feb 13 13:52:37 UTC 2023


On Monday, 13 February 2023 at 13:12:23 UTC, Steve wrote:
> The app is just a test echo server. JSON sent in the body of a 
> POST request is echoed back to the client. On Pop!_OS it works 
> fine but on Windows it responds, there's a delay of about 10 
> seconds and then it crashes with the error:
>
> ```
> Error Program exited with code -1073741819
> ```
>
> Here's the code:
> ```d
> import vibe.vibe;
> import std.json, std.stdio;
>
> void main() {
> 	auto settings = new HTTPServerSettings;
> 	settings.port = 8080;
> 	settings.bindAddresses = ["::1", "127.0.0.1"];
>
>     auto router = new URLRouter;
>     router.get("*", serveStaticFiles("public/"));
>     router.post("/", &onPost);
>
> 	auto listener = listenHTTP(settings, router);
> 	scope (exit) { listener.stopListening(); }
>
> 	logInfo("App listening at http://127.0.0.1:8080/");
> 	runApplication();
> }
>
> static string handlePost(string req) {
>     return req;
> }
>
> void onPost(HTTPServerRequest req, HTTPServerResponse res) {
>     try {
>         auto jsr = async(&handlePost, 
> req.json.toString()).getResult();
>         res.contentType("application/json; charset=utf-8");
>         res.writeBody(jsr);
>     } catch (Exception e) {
>         res.contentType("text/plain; charset=utf-8");
>         res.writeBody(e.msg);
>     }
> }
> ```
>
> Also when you launch/build the app with dub there's a shed load 
> of deprecation warnings, e.g.:
> ```
> \Local\dub\packages\vibe-d-0.9.5\vibe-d\stream\vibe\stream\wrapper.d(334,23): Deprecation: reference to local variable `this` assigned to non-scope parameter `bytes` calling `writeToStream`
> ```
>
> I'm a D newbie so it's quite possibly something I'm doing wrong 
> ...

The -1073741819 error is OxC0000005 in hex.

And C0000005 on Windows is a access violation exception, 
indicating that you are trying to access memory that doesn't 
belong to your process. Possibly a 'buffer overrun' access 
exception - but I'm not sure in this case.

Unfortunately I'm not experienced with vibe at all - so I can't 
help with your code.

Just google 'Windows error C0000005' for more info.


More information about the Digitalmars-d-learn mailing list