RejectedSoftware Forums

Sign up

Exception woes (Reached EOF before reaching end marker, Range violation)

Hi,

I have encountered two exceptions that give me a headache. First one in the "Reached EOF before reaching end marker" that appears when I do more than 6 parallel connections to a single page.

This is the exception:

object.Exception@../../.dub/packages/vibe-d-0.7.20/source/vibe/stream/operations.d(181): Reached EOF before reaching end marker.
----------------
./wdjob(pure @safe bool std.exception.enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong)+0x6b) [0x65c54f]
./wdjob(void vibe.stream.operations.readUntil(vibe.core.stream.InputStream, vibe.core.stream.OutputStream, const(ubyte[]), ulong)+0x67c) [0x6fa754]
./wdjob(ubyte[] vibe.stream.operations.readUntil(vibe.core.stream.InputStream, const(ubyte[]), ulong, shared(vibe.utils.memory.Allocator))+0xbc) [0x6fa060]
./wdjob(ubyte[] vibe.stream.operations.readLine(vibe.core.stream.InputStream, ulong, immutable(char)[], shared(vibe.utils.memory.Allocator))+0x38) [0x6f9fa0]
./wdjob(vibe.http.client.HTTPClientResponse vibe.http.client.HTTPClientResponse.__ctor(vibe.http.client.HTTPClient, bool, bool, shared(vibe.utils.memory.Allocator))+0x81) [0x6ece8d]
./wdjob(vibe.http.client.HTTPClientResponse std.conv.emplace!(vibe.http.client.HTTPClientResponse, vibe.http.client.HTTPClient, bool, bool, shared(vibe.utils.memory.Allocator)).emplace(void[], ref vibe.http.client.HTTPClient, ref bool, ref bool, ref shared(vibe.utils.memory.Allocator))+0xd4) [0x71f854]
./wdjob(std.typecons.scoped!(vibe.http.client.HTTPClientResponse).Scoped std.typecons.scoped!(vibe.http.client.HTTPClientResponse).scoped!(vibe.http.client.HTTPClient, bool, bool, shared(vibe.utils.memory.Allocator)).scoped(ref vibe.http.client.HTTPClient, ref bool, ref bool, ref shared(vibe.utils.memory.Allocator))+0x93) [0x71f73b]
./wdjob(void vibe.http.client.HTTPClient.request(scope void delegate(scope vibe.http.client.HTTPClientRequest), scope void delegate(scope vibe.http.client.HTTPClientResponse))+0xdc) [0x6eb744]
./wdjob(void BasicHttpAttackModule.BasicHttpAttackModule.attack(std.uuid.UUID, immutable(char)[], ComboList.Combo, ProxyList.Proxy, void delegate(ComboList.Combo), void delegate(ComboList.Combo), void delegate(ComboList.Combo))+0x1dd) [0x68ac09]
./wdjob(void JobTask.JobTask.run(uint*, immutable(char)[], ComboList.Combo, ProxyList.Proxy, void delegate(ComboList.Combo), void delegate(ComboList.Combo), void delegate(ComboList.Combo))+0xaf) [0x6b2a13]
./wdjob(_D4vibe4core4core121__T7runTaskTPkTAyaTS9ComboList5ComboTS9ProxyList5ProxyTDFS9ComboList5ComboZvTDFS9ComboList5ComboZvTDFS9ComboList5ComboZvZ7runTaskFDFPkAyaS9ComboList5ComboS9ProxyList5ProxyDFS9ComboList5ComboZvDFS9ComboList5ComboZvDFS9ComboList5ComboZvZvPkAyaS9ComboList5ComboS9ProxyList5ProxyDFS9ComboList5ComboZvDFS9ComboList5ComboZvDFS9ComboList5ComboZvZS4vibe4core4task4Task12callDelegateFC4vibe4core4core8CoreTaskZv+0xb2) [0x6a983e]
./wdjob(void vibe.core.core.CoreTask.run()+0x146) [0x6ba336]
./wdjob(void core.thread.Fiber.run()+0x2a) [0x7f2b1a]
./wdjob(fiber_entryPoint+0x61) [0x7f2a25]
[(nil)]

and the associated code:

auto client = connectHTTP(host, port, false);

client.request(
  (scope req)
  {
    req.host         = url.host;
    req.requestURL   = target;
    req.method       = HTTPMethod.GET;
    auto comboString = combo.username() ~ ":" ~ combo.password();
    auto authString  = "Basic " ~ Base64.encode(representation(comboString));
    req.headers.addField("Authorization", cast(string)authString);
  },
  (scope res)
  {
    ...
  }
);

The second exception is "Task terminated with unhandled exception: Range violation". I am, however, not sure how I can catch this one. I've put try/catch around runTask and the function that is ran and nothing handled it.

Thank you for any advice.

Drasha

Re: Exception woes (Reached EOF before reaching end marker, Range violation)

On Mon, 28 Jul 2014 09:50:02 GMT, Drasha wrote:

Hi,

I have encountered two exceptions that give me a headache. First one in the "Reached EOF before reaching end marker" that appears when I do more than 6 parallel connections to a single page.

This is the exception:

object.Exception@../../.dub/packages/vibe-d-0.7.20/source/vibe/stream/operations.d(181): Reached EOF before reaching end marker.
(...)

and the associated code:
(...)

There is a ticket with the same error. Maybe the reason is that the server only accepts a maximum of 6 connections? It would definitely be good to implement a limit on the number of parallel connections for ConnectionPool anyway.

The second exception is "Task terminated with unhandled exception: Range violation". I am, however, not sure how I can catch this one. I've put try/catch around runTask and the function that is ran and nothing handled it.

You'd need to catch(Throwable ex), but then it should work. The alternative is to define "versions": ["VibeDebugCatchAll"] in the dub.json. This will cause vibe.d to catch any Throwable and log its contents instead of just killing the process.

Alternatively, you could load up the application in GDB and use break _d_throwc to see where the exception is thrown (assuming that there are not a lot of other exceptions).

Re: Exception woes (Reached EOF before reaching end marker, Range violation)

On Mon, 28 Jul 2014 10:02:23 GMT, Sönke Ludwig wrote:

There is a ticket with the same error. Maybe the reason is that the server only accepts a maximum of 6 connections? It would definitely be good to implement a limit on the number of parallel connections for ConnectionPool anyway.

It is possible. I'll look into it...

You'd need to catch(Throwable ex), but then it should work. The alternative is to define "versions": ["VibeDebugCatchAll"] in the dub.json. This will cause vibe.d to catch any Throwable and log its contents instead of just killing the process.

Alternatively, you could load up the application in GDB and use break _d_throwc to see where the exception is thrown (assuming that there are not a lot of other exceptions).

Thanks for the suggestions. It seems that the error is in fact in std.logger.

Drasha