I've encountered an unusual behavior that I have no good explanation for. Consider the following code example:

```d
import vibe.core.log : logInfo;
import vibe.http.client : requestHTTP, HTTPClientRequest, HTTPClientResponse;
import vibe.http.common : HTTPMethod;
import vibe.stream.operations : readAllUTF8;

void doThing() {
  requestHTTP("http://example.com/";,
      (scope HTTPClientRequest req) {
        logInfo("Setting request method.");
        req.method = HTTPMethod.GET;
      },
      (scope HTTPClientResponse res) {
        logInfo("Log point 1");
        string data = res.bodyReader.readAllUTF8();
        logInfo("Log point 2: %s", data);
      });
}

static this() {
  logInfo("--- static this() ---");
  doThing();
}

void main(string[] args) {
  logInfo("--- main() ---");
  doThing();
}
```

The output of this program is actually an infinite loop with output of the form:
```
[Eventcore DNS Lookup(----) INF] --- static this() ---
[Eventcore DNS Lookup(----) INF] --- static this() ---
```

If I remove the call from `static this()`, then the web call works as normal. Any idea why calling vibe.d's `requestHTTP` function inside of a module's static construction would cause an infinite loop?

Reply via email to