doujiang24 / lua-resty-kafka

Lua kafka client driver for the Openresty based on the cosocket API
BSD 3-Clause "New" or "Revised" License
802 stars 275 forks source link

104: Connection reset by peer #33

Open leocook opened 8 years ago

leocook commented 8 years ago

The error log is:

2016/07/27 14:02:56 [error] 7253#0: *25 recv() failed (104: Connection reset by peer), client: 192.168.1.111, server: 192.168.1.160, request: "GET /collect HTTP/1.1", host: "192.168.1.160:4002"

and the config is:

location /collect {
            lua_need_request_body on;
            client_max_body_size 5M;
            client_body_buffer_size 256k;
            default_type application/json;

            content_by_lua '
                local cjson = require "cjson"
                local client = require "resty.kafka.client"
                local producer = require "resty.kafka.producer"

                local broker_list = {
                    { host = "192.168.1.151", port = 9092 }
                }
                local key = "key"
                local message = "halo world"

                -- sync producer_type
                local p = producer:new(broker_list)

                local offset, err = p:send("demo2", key, message)
                if not offset then
                    ngx.say("send err:", err)
                    return
                end
                ngx.say("send success, offset: ", tonumber(offset))

                ngx.say("send success, ok:", ok)
            ';
        }
leocook commented 8 years ago

The error above occur when the kafka's version is 0.8.2.0-1.kafka1.3.0.p0.29 of cdh.

But when change to kafka_2.10-0.8.2.0 of apache, it works!

who can tell me why?

doujiang24 commented 8 years ago

@leocook It's a little bit strange, but I don't have enough time to step in now, may be you can capture the network to step in by tcpdump?