tarantool / nginx_upstream_module

Tarantool NginX upstream module (REST, JSON API, websockets, load balancing)
Other
174 stars 18 forks source link

[1.7.4+ Tarantool] Assertion failed in iproto_decode_msg on incorrect input #79

Closed Totktonada closed 7 years ago

Totktonada commented 7 years ago

How to reproduce:

$ curl -D - -X POST -d '{"1":{"2":"3"}}' http://localhost/api/any-url-handled-by-tarantool
HTTP/1.1 502 Bad Gateway
Server: nginx/1.11.10
Date: Wed, 19 Apr 2017 16:46:26 GMT
Content-Type: text/html
Content-Length: 174
Connection: keep-alive
Keep-Alive: timeout=20

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.11.10</center>
</body>
</html>

Note 1: params forgotten. Note 2: {"1": "2"} handled correctly.

Last line of tarantool log:

tarantool: /var/tmp/portage/dev-db/tarantool-9999/work/tarantool-9999/src/box/iproto.cc:559: void iproto_decode_msg(iproto_msg*, const char**, const char*, bool*): Assertion `*pos == reqend' failed.
Totktonada commented 7 years ago

nginx.conf:

load_module "modules/ngx_http_tnt_module.so";

user nginx nginx;
worker_processes 1;

error_log /var/log/nginx/error_log info;

events {
        worker_connections 1024;
        use epoll;
}

http {
        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        log_format main
                '$remote_addr - $remote_user [$time_local] '
                '"$request" $status $bytes_sent '
                '"$http_referer" "$http_user_agent" '
                '"$gzip_ratio"';

        client_header_timeout 10m;
        client_body_timeout 10m;
        send_timeout 10m;

        connection_pool_size 256;
        client_header_buffer_size 1k;
        large_client_header_buffers 4 2k;
        request_pool_size 4k;

        gzip off;

        output_buffers 1 32k;
        postpone_output 1460;

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;

        keepalive_timeout 75 20;

        ignore_invalid_headers on;

        index index.html;
        include blah-blah-blah.conf;
}

blah-blah-blah.conf:

upstream tnt {
    server localhost:3301 max_fails=1 fail_timeout=60s;
    keepalive 250000;
}

server {
    server_name tnt_test;

    listen 80 default deferred reuseport so_keepalive=on backlog=65535;
    rewrite ^/(.*)/$ /$1 permanent;

    location / {
        root /var/www/blah-blah-blah;
    }

    location /api {
        # answers check infinity timeout
        tnt_read_timeout 60m;
        tnt_method "process_request";
        tnt_http_methods get post put delete;
        tnt_multireturn_skip_count 2;
        tnt_pure_result on;
        tnt_pass_http_request on parse_args;
        tnt_pass tnt;
        default_type application/json;
    }
}
rtsisyk commented 7 years ago

Duplicate of https://github.com/tarantool/tarantool/issues/2540