GithubHelp home page GithubHelp logo

shm_add_upstream about nginx-module-vts HOT 12 CLOSED

vozlt avatar vozlt commented on July 20, 2024
shm_add_upstream

from nginx-module-vts.

Comments (12)

vozlt avatar vozlt commented on July 20, 2024

Thanks for the report.
But I could not reproduce the problem.
I wondering, is that a log is every time written while requested?
And can I get a your nginx configuraton?

from nginx-module-vts.

romankoblov avatar romankoblov commented on July 20, 2024

Hi, there is minimal config on which I reproduced this issue:

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
    worker_connections 768;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    vhost_traffic_status_zone;
    server
    {
        listen 80;
        location /status {
            vhost_traffic_status_display;
        vhost_traffic_status_display_format json;
        }
    }
}

And here is curl to json:

curl localhost/status
{"nginxVersion":"1.7.10","loadMsec":1428505244822,"nowMsec":1428505417996,"connections":{"active":1,"reading":0,"writing":1,"waiting":0,"accepted":13,"handled":13,"requests":13},"serverZones":{"8Ly":{"requestCounter":12,"inBytes":948,"outBytes":6689,"responses":{"1xx":0,"2xx":12,"3xx":0,"4xx":0,"5xx":0}},"*":{"requestCounter":12,"inBytes":948,"outBytes":6689,"responses":{"1xx":0,"2xx":12,"3xx":0,"4xx":0,"5xx":0}}}}

Notice '8Ly' as zone name, it changes, sometimes here is some binary data.
If i'm adding 'server_name test;' to this config it works fine (zone name: 'test')

from nginx-module-vts.

vozlt avatar vozlt commented on July 20, 2024

I added default server_name "_" in ngx_http_vhost_traffic_status_shm_add_server(), if the server_name directive is not defined.
Give it a fly, please give me the result.

Last Commit: bd63446

from nginx-module-vts.

romankoblov avatar romankoblov commented on July 20, 2024

Hi, thank you for fix, now it works correctly.
Another problem, I've just noticed that upstream metrics counts incorrectly:

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
    worker_connections 768;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    vhost_traffic_status_zone;
    upstream site
    {
        ip_hash;
            server localhost:3000;
            keepalive 256;
        }
    server {
        listen 80;
        server_name example.com test.example.com;
        location /{
            proxy_pass http://site$request_uri;
        }
    }
        server {
            listen 80;
        }
    server
    {
        listen 8011;
        server_name stats;
        location /status {
            vhost_traffic_status_display;
        vhost_traffic_status_display_format json;
        }
    }
}

after request to example.com, it counts in 'example.com' zone, but there is nothing in upsteam zone:
{"nginxVersion":"1.7.10","loadMsec":1428607075816,"nowMsec":1428607145151,"connections":{"active":1,"reading":0,"writing":1,"waiting":0,"accepted":8,"handled":8,"requests":8},"serverZones":{"stats":{"requestCounter":3,"inBytes":252,"outBytes":2403,"responses":{"1xx":0,"2xx":3,"3xx":0,"4xx":0,"5xx":0}},"_":{"requestCounter":1,"inBytes":86,"outBytes":324,"responses":{"1xx":0,"2xx":0,"3xx":0,"4xx":1,"5xx":0}},"example.com":{"requestCounter":3,"inBytes":235,"outBytes":2540,"responses":{"1xx":0,"2xx":2,"3xx":0,"4xx":0,"5xx":1}},"*":{"requestCounter":7,"inBytes":573,"outBytes":5267,"responses":{"1xx":0,"2xx":5,"3xx":0,"4xx":1,"5xx":1}}},"upstreamZones":{"site":[{"server":"127.0.0.1:3000","requestCounter":0,"inBytes":0,"outBytes":0,"responses":{"1xx":0,"2xx":0,"3xx":0,"4xx":0,"5xx":0},"responeMsec":0,"weight":1,"maxFails":1,"failTimeout":10,"backup":false,"down":false}]}}

from nginx-module-vts.

vozlt avatar vozlt commented on July 20, 2024

Thank you for looking into this.
I fixed it.
Give it a fly, please give me the result.

Last commit: 5548b2d

from nginx-module-vts.

romankoblov avatar romankoblov commented on July 20, 2024

Hi, now it works fine, thank you!

from nginx-module-vts.

stankevich avatar stankevich commented on July 20, 2024

This is still an issue if there are multiple entries in server_name. To reproduce: use @penpen's snippet above and add server_name example.com *.example.com; in server block.

Throws handler::shm_add_upstream() failed while logging request error.

Nginx 1.9.10, latest master branch of this module.

from nginx-module-vts.

vozlt avatar vozlt commented on July 20, 2024

Thanks.
I failed to occur the message by using above configuration.
Does it frequently appears?
Can I get the your configuration to reproduce?

from nginx-module-vts.

vs801 avatar vs801 commented on July 20, 2024

Thanks for great nginx module.
Same problem: in error log handler::shm_add_upstream() failed while logging request. Nginx 1.8.0, latest zip-archive with master branch of this module, error generated for all requests. In conf files using two type of server_name:
server_name: _
and
server_name: s1.example.com s2.example.com s3.example.com s4.example.com s5.example.com
Maybe problem in my my nginx-conf files - I'm don't have static upstream sections and using internal redirect and generate proxy_pass links for many different upstreams.
In function ngx_http_vhost_traffic_status_shm_add_upstream check's configured upstream in conf-files or not?

from nginx-module-vts.

vozlt avatar vozlt commented on July 20, 2024

Does it appears on all requests?(one log per a request)
If so, can I get a nginx configuration to be reproduced?

from nginx-module-vts.

seven-wjx avatar seven-wjx commented on July 20, 2024

nginx version: nginx/1.11.1

Error info:

2016/07/20 18:25:40 [error] 30780#30780: *549 handler::shm_add_upstream() failed while logging request, client: 172.16.189.197, server: xxxxxxx.com, request: "GET /phpinfo_172.30.2.87.php?apc_clear_cache=sys HTTP/1.1", upstream: "fastcgi://172.30.2.87:9000", host: “xxxxxxx.com”

It happened when nginx fastcgi_pass use variables:

server {
    listen 80 ;
    server_name xxxxxxx;
    access_log logs/access.log main;
    error_log logs/error.log debug;
    location ~ "^/phpinfo_(.*)\.php$" {
    fastcgi_pass   $1:9000;                   ##### it not happened error when fastcgi_pass  use not variables:   fastcgi_pass 172.30.2.87:9000
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME     /home/deploy/liveapi/phpinfo.php;
    include fastcgi_params;
    }
    location /status {
        vhost_traffic_status_display;
        vhost_traffic_status_display_format html;
    }
}

from nginx-module-vts.

vozlt avatar vozlt commented on July 20, 2024

Hi, Thanks for reporting.
The latest code has now patched. (389f350)
Please test...

from nginx-module-vts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.