warn: Flooding detected! .... warn: [socket.io] Too many emits!

Technical Support
  • We are running nodebb 1.10.1 on a fairly busy server, configured currently with 8 node processes (which nginx is proxying across), and everything seems to work pretty well as far as the forum's web UI responsiveness / lack of 503s / etc (these are some issues we ran into earlier, before we had properly configured it to use more than one node process).

    Recently I was checking the nodebb logs and I came across a number of messages like the following -

    $ grep -A1 "Flooding" output.log | head -2
    2018-11-10T19:43:36.348Z [7599] - warn: Flooding detected! Calls : 101, Duration : 2
    2018-11-10T19:43:36.352Z [7599] - warn: [socket.io] Too many emits! Disconnecting uid : 47371. Events : plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview,plugins.composer.renderPreview

    $ grep -A1 "Flooding" output.log | tail -2
    2018-12-14T17:48:42.266Z [2325] - warn: Flooding detected! Calls : 101, Duration : 7459
    2018-12-14T17:48:42.268Z [2325] - warn: [socket.io] Too many emits! Disconnecting uid : 0. Events : categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore,categories.loadMore

    $ grep -c "Flooding detected" output.log
    272

    I haven't been able to to 100% correlate this with actual performance issues on the forum, but it's still a bit worrying.. we have had occasional complaints about responsiveness, and actually we had significant problems before a recent change from 4 nodebb ports/processes to 8, which helped immensely.

    In any case, from the research I've done this is related to socket.emit() firing too often (20 times a second is the number I keep seeing)... If you count up the number of comma separated print outs of "categories.loadMore", or plugins.composer.renderPreview in the first example, in each of those log lines, it is exactly 20.

    Is this a genuine issue to worry about? Is it possible this is just because the forum is doing so much traffic? Does anyone have any suggestions on how to drill down farther into this?

    thanks!
    John

  • Those messages are printed when a single socket(user) sends a high number of socket.emits in a short duration. You can find the relevant code here https://github.com/NodeBB/NodeBB/blob/master/src/middleware/ratelimit.js#L10. If a user makes more than 100 socket.emits in the span of 10 seconds then they are disconnected.

    As for why you are seeing them my guess is those users had connection problems and when they got reconnected socket.io sent a lot of emits instantly which triggered the flooding logic.

  • @baris said in warn: Flooding detected! .... warn: [socket.io] Too many emits!:

    Those messages are printed when a single socket(user) sends a high number of socket.emits in a short duration. You can find the relevant code here https://github.com/NodeBB/NodeBB/blob/master/src/middleware/ratelimit.js#L10. If a user makes more than 100 socket.emits in the span of 10 seconds then they are disconnected.
    As for why you are seeing them my guess is those users had connection problems and when they got reconnected socket.io sent a lot of emits instantly which triggered the flooding logic.

    Thank you, this is helpful!

    Is it possible that this is legit traffic from a user, would a browser and nodebb ever be that chatty? Or do you think it is more likely someone probing / poking at the server in some way? Thanks!

  • Sorry, I didn't really process your full message. At the end you state your guess these are users with connection problems who got reconnected... based on the relatively small number of times I see this warning, as compared to over-all traffic to the forum, it sounds like I can probably ignore the warning. Thanks for your help.


Suggested Topics


  • anti-flood

    Unsolved Technical Support
    -1 Votes
    3 Posts
    230 Views

    @macfan so you came to the NodeBB community forum to complain about the preferences of a admin running a completely different forum and demanded that people that have no ties whatsoever to that forum change jt for you?

    Why not talk to the admins on that site, it’s not from here.

  • 0 Votes
    2 Posts
    358 Views

    SOLVED

    Added

    socket.io {"address": */*};

    Default "address:" **; that's is problem.

  • 0 Votes
    5 Posts
    718 Views

    here the main config for the vhost:

    #ATTENTION! # #DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY, #SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED. server { listen 212.227.91.81:443 ssl http2; server_name community.hypercube-evolution.de; server_name www.community.hypercube-evolution.de; server_name ipv4.community.hypercube-evolution.de; server_name "community.hypercube-evolution.de.212-227-91-81.siam-net.de"; ssl_certificate /usr/local/psa/var/certificates/scfbHTbkW; ssl_certificate_key /usr/local/psa/var/certificates/scfbHTbkW; ssl_client_certificate /usr/local/psa/var/certificates/scfLt0HmX; client_max_body_size 128m; root "/var/www/vhosts/hypercube-evolution.de/community.hypercube-evolution.de"; access_log "/var/www/vhosts/system/community.hypercube-evolution.de/logs/proxy_access_ssl_log"; error_log "/var/www/vhosts/system/community.hypercube-evolution.de/logs/proxy_error_log"; #extension letsencrypt begin location ^~ /.well-known/acme-challenge/ { root /var/www/vhosts/default/htdocs; types { } default_type text/plain; satisfy any; auth_basic off; allow all; location ~ ^/\.well-known/acme-challenge.*/\. { deny all; } } #extension letsencrypt end location / { proxy_pass https://212.227.91.81:7081; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Accel-Internal /internal-nginx-static-location; access_log off; } location /internal-nginx-static-location/ { alias /var/www/vhosts/hypercube-evolution.de/community.hypercube-evolution.de/; internal; } location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) { proxy_pass https://212.227.91.81:7081; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Accel-Internal /internal-nginx-static-location; access_log off; } location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ { alias /var/www/vhosts/hypercube-evolution.de/web_users/$1/$2; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass "unix:///var/www/vhosts/system/community.hypercube-evolution.de/php-fpm.sock"; include /etc/nginx/fastcgi.conf; } location ~ ^/~(.+?)(/.*)?$ { proxy_pass https://212.227.91.81:7081; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Accel-Internal /internal-nginx-static-location; access_log off; } location ~ \.php(/.*)?$ { fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass "unix:///var/www/vhosts/system/community.hypercube-evolution.de/php-fpm.sock"; include /etc/nginx/fastcgi.conf; } location ~ /$ { index "index.html" "index.cgi" "index.pl" "index.php" "index.xhtml" "index.htm" "index.shtml"; } add_header X-Powered-By PleskLin; include "/var/www/vhosts/system/community.hypercube-evolution.de/conf/vhost_nginx.conf"; }

    and here the include

    location ~ / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:4567; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }
  • 0 Votes
    4 Posts
    3k Views

    @PitaJ WOW thanks. Didn't think about that.I'm new with node.js.

  • 0 Votes
    3 Posts
    3k Views

    @Async0x42 I was able to solve it by adding the subdomain (e.g forum.servername.com) in the "url" of config.js.