June 26, 2020
We would like to use vibe.d for a simple backend, but run into strange behavior with HTTP request. The backend is simple: it receives requests from clients and makes requests for some json contents. Now, the code is only a vibe.d basic http server and a sample http request from vibe.d example.

Sometimes(very often) we got the error:

"statusMessage":"Second attempt to send HTTP request failed.","statusDebugMessage":"object.Exception@../../../.dub/packages/vibe-d-0.8.6/vibe-d/http/vibe/http/client.d(615): Second attempt to send HTTP request failed.\n----------------\n/usr/include/dlang/dmd/std/exception.d:516 pure..."

It starts happening when there is no request for a few seconds. The error comes only, when I read the response (res.readJson(); or res.bodyReader.readAllUTF8();).

Our simple test case is: start vibe.d server, open a browser. Opening our server url makes a http request to our vibe.d server, which tries to make a http request to an another server.

I found some related content here: https://github.com/vibe-d/vibe.d/issues/2290
And here (second commenter is me): https://github.com/vibe-d/vibe.d/issues/2451

We use the latest stable vibe.d(0.8.6), dub and dmd.

We tried several things, but nothing works.