RejectedSoftware Forums

Sign up

Vibe Error

I was running some benchmarks with the apache-bench and the following error showed up:

[B72F3F80:B72F6DC0 WRN] Handling of connection failed: Remote hung up while operating on TCPConnection.
[B72F3F80:00000000 ERR] Task terminated with unhandled exception: object.Exception@/home/dev/apps/vibe.d/source/vibe/core/drivers/libevent2_tcp.d(470): Error reading data from socket. Remote hung up?

/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void vibe.core.core.CoreTask.run()+0x21) [0x81e9a31]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void core.thread.Fiber.run()+0x21) [0x8224de1]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(fiber_entryPoint+0x4e) [0x8224d1e]
[(nil)]

I did this with 10 concurrent users and trying 100,000 requests. I can only tell you right now that I was interacting with a Redis database on all of these requests, so I don't know if that' why it failed or if it was due to something else. I would provide code, but it's work-related, so I can't publish it. However, when I get some time, I'll try to duplicate it with some different code. I just wanted to make you aware of this before I forgot.

Re: Vibe Error

Am 29.11.2012 21:09, schrieb Casey:

I was running some benchmarks with the apache-bench and the following error showed up:

[B72F3F80:B72F6DC0 WRN] Handling of connection failed: Remote hung up while operating on TCPConnection.
[B72F3F80:00000000 ERR] Task terminated with unhandled exception:
object.Exception@/home/dev/apps/vibe.d/source/vibe/core/drivers/libevent2_tcp.d(470): Error reading
data from socket. Remote hung up?

/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void
vibe.core.core.CoreTask.run()+0x21) [0x81e9a31]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void core.thread.Fiber.run()+0x21)
[0x8224de1]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(fiber_entryPoint+0x4e) [0x8224d1e]
[(nil)]

I did this with 10 concurrent users and trying 100,000 requests. I can only tell you right now that
I was interacting with a Redis database on all of these requests, so I don't know if that' why it
failed or if it was due to something else. I would provide code, but it's work-related, so I can't
publish it. However, when I get some time, I'll try to duplicate it with some different code. I
just wanted to make you aware of this before I forgot.

Can you try to redo this running with vibe -- -v? It should them print out a call stack for the
first warning. Maybe it becomes clearer where the connection goes wrong.

Re: Vibe Error

Here ya go:

[B72ACF80:B72AF100 WRN] Handling of connection failed: Remote hung up while operating on TCPConnection.
[B72ACF80:B72AF100 dbg] object.Exception@/home/dev/apps/vibe.d/source/vibe/core/drivers/libevent2_tcp.d(273): Remote hung up while operating on TCPConnection.
----------------
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(pure @safe bool std.exception.enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], uint)+0x2c) [0x81b6ce4]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void vibe.core.drivers.libevent2_tcp.Libevent2TcpConnection.checkConnected()+0x7d) [0x81fd539]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void vibe.core.drivers.libevent2_tcp.Libevent2TcpConnection.write(const(ubyte[]), bool)+0x44) [0x81fd328]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void vibe.stream.stream.OutputStream.write(const(char[]), bool)+0x42) [0x81a9816]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void vibe.http.server.HttpServerResponse.writeHeader()+0x128) [0x8171c2c]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(@property vibe.stream.stream.OutputStream vibe.http.server.HttpServerResponse.bodyWriter()+0x1de) [0x8171526]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(bool vibe.http.server.handleRequest(vibe.stream.stream.Stream, immutable(char)[], vibe.http.server.HTTPServerListener, ref vibe.http.server.HttpServerSettings).void errorOut(int, immutable(char)[], immutable(char)[], object.Throwable)+0x177) [0x81740e3]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(bool vibe.http.server.handleRequest(vibe.stream.stream.Stream, immutable(char)[], vibe.http.server.HTTPServerListener, ref vibe.http.server.HttpServerSettings)+0xf8e) [0x8173d36]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void vibe.http.server.handleHttpConnection(vibe.core.net.TcpConnection, vibe.http.server.HTTPServerListener)+0x143) [0x8172d2f]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void vibe.http.server.listenHttpPlain(vibe.http.server.HttpServerSettings, void delegate(vibe.http.server.HttpServerRequest, vibe.http.server.HttpServerResponse)).void doListen(vibe.http.server.HttpServerSettings, vibe.http.server.HTTPServerListener, immutable(char)[]).void __lambda12(vibe.core.net.TcpConnection)+0x27) [0x8170b63]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(extern (C) nothrow void vibe.core.drivers.libevent2_tcp.onConnect(int, short, void*).void ClientTask.execute()+0x200) [0x81fda98]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void vibe.core.core.CoreTask.run()+0x5d) [0x81efe79]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(void core.thread.Fiber.run()+0x21) [0x8229e11]
/tmp/.rdmd-1000/rdmd-app.d-680553F408B240E4B699E899B567B6C1/app(fiber_entryPoint+0x4e) [0x8229d4e]
[(nil)]

Re: Vibe Error

Here's a sample program that you can use to duplicate the error I'm getting,
in case you need it. The init just creates some dummy data.

I benchmarked this with: ab -c 100 -n 100000 http://localhost:8080/test

import vibe.d;

void doInit(HttpServerRequest req, HttpServerResponse res)
{
    auto redis = new RedisClient();
    redis.connect("127.0.0.1", 6379);
    string key = "testkey";

    for (int i = 0; i < 1000; i++)
    {
        redis.request("ZADD", cast(ubyte[])key,
                      cast(ubyte[])to!(string)(i),
                      cast(ubyte[])to!(string)(i));
    }
    res.statusCode = HttpStatus.Created;
    res.writeBody("");
}

void getTest(HttpServerRequest req, HttpServerResponse res)
{
    auto redis = new RedisClient();
    redis.connect("127.0.0.1", 6379);
    string key = "testkey";
    auto items = redis.request("ZREVRANGEBYSCORE",
                               cast(ubyte[])key,
                               cast(ubyte[])to!(string)(int.max),
                               cast(ubyte[])"0");
    string[] itemList;
    while (items.hasNext)
    {
        itemList ~= items.next!(string)();
    }
    res.writeJsonBody(itemList);
}

shared static this()
{
    auto router = new UrlRouter;
    router.get("/test", &getTest)
          .post("/init", &doInit);

    auto settings = new HttpServerSettings;
    settings.port = 8080;
    listenHttp(settings, router);
}

FYI: for some reason, if I pass "localhost" into the redis.connect method, it
doesn't connect to redis. I have to explicitly put 127.0.0.1 in.