20% CPU usage when idle #1065

Closed
opened 2026-10-05 05:01:12 +02:00 by adam · 0 comments
Owner

Hi,

Recently, znc started using about 20% CPU (as seen from htop) when doing nothing.
Here's the loop znc is stuck into as seen by strace (shortened a bit for readability);

38200 03:17:55.613288 write(30, "\26\3\1\6\v\1\0\6\7\3\3\343\240N\272\320I\25C\242;\327Z\223\20\341P\200\312\210=|*\255\347\305F\267\355(\216\346j \24\7\266\311\334\237\356\250X\230h\362bG(nW\262\325\246^\231\271\31|\275\30\222\361G\361\354\08\23\2\23\3\23\1\300+\300/\300,\3000\314\251\314\250\0\236\0\237\314\252\300#\300'\300\t\300\23\300$\300(\300\n\300\24\0g\0k\0\234\0\235\0<\0=\0/\0005\1\0\5\206\377\1\0\1\0\0\0\0\23\0\21\0\0\16irc.epd-me.net\0\v\0\4\3\0\1\2\0\n\0\22\0\20\21\354\0\35\0\27\0\36\0\30\0\31\1\0\1\1\0#\0\0\0\26\0\0\0\27\0\0\0\r\0006\0004\t\5\t\6\t\4\4\3\5\3\6\3\10\7\10\10\10\32\10\33\10\34\10\t\10\n\10\v\10\4\10\5\10\6\4\1\5\1\6\1\3\3\3\1\3\2\4\2\5\2\6\2\0+\0\5\4\3\4\3\3\0-\0\2\1\1\0003\4\352\4\350\21\354\4\300ic\304\2523j\334\371\252R\304\34Q\205\t\373\374\5\240glP\226\270\334I\216\376z@\353\360\265\231h\305zS9\361lq9\331\6\3539\221\364\201\272\23\26\233<;l\2362\226\334\2)\221\2066\36\\\1@\313\3Is\313\0\227\35\251\347\264=\340G\220 }G\27\216O\326_\333cx\336\231N\260\312k\203\243\266,a`\27\210!\203f\n@$b\231\232$M`_\vC\23\213\\\257\234%\202\360d{\313\207q)D\223x\320uP\226\21\0\212\264\207\374O\220\305C\v\240\216x\232\307\364\231\245\"\301\\\236\230y\203\347\301JI\177\260T\206\254\201H\355\20\307\342\303]\33|\264\366jE\\\205\300BUxk\200\277`\366#\306\v2\211\253z4\3116z\232f\200e"..., 1552) = -1 EAGAIN (Ressource temporairement non disponible)
38200 03:17:55.613485 poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=13, events=POLLIN}, {fd=14, events=POLLIN}, {fd=15, events=POLLIN}, {fd=16, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=19, events=POLLIN}, {fd=20, events=POLLIN}, {fd=21, events=POLLIN}, {fd=22, events=POLLIN}, {fd=23, events=POLLIN}, {fd=24, events=POLLIN}, {fd=25, events=POLLIN}, {fd=27, events=POLLIN}, {fd=28, events=POLLIN}, {fd=29, events=POLLIN}, {fd=30, events=POLLIN|POLLOUT}, {fd=31, events=POLLIN}, {fd=32, events=POLLIN}, {fd=33, events=POLLIN}, {fd=34, events=POLLIN}, {fd=35, events=POLLIN}, {fd=36, events=POLLIN}, {fd=37, events=POLLIN}, {fd=38, events=POLLIN}, {fd=39, events=POLLIN}, {fd=40, events=POLLIN}, {fd=41, events=POLLIN}, {fd=42, events=POLLIN}, {fd=43, events=POLLIN}, {fd=44, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=47, events=POLLIN}, {fd=48, events=POLLIN}, {fd=50, events=POLLIN}], 43, 1) = 0 (Timeout)
38200 03:17:55.615005 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=411690538}) = 0
38200 03:17:55.615196 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=411847959}) = 0
...
38200 03:17:55.618688 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=415336153}) = 0
38200 03:17:55.618838 write(30, "\26\3\1\6\v\1\0\6\7\3\3\343\240N\272\320I\25C\242;\327Z\223\20\341P\200\312\210=|*\255\347\305F\267\355(\216\346j \24\7\266\311\334\237\356\250X\230h\362bG(nW\262\325\246^\231\271\31|\275\30\222\361G\361\354\08\23\2\23\3\23\1\300+\300/\300,\3000\314\251\314\250\0\236\0\237\314\252\300#\300'\300\t\300\23\300$\300(\300\n\300\24\0g\0k\0\234\0\235\0<\0=\0/\0005\1\0\5\206\377\1\0\1\0\0\0\0\23\0\21\0\0\16irc.epd-me.net\0\v\0\4\3\0\1\2\0\n\0\22\0\20\21\354\0\35\0\27\0\36\0\30\0\31\1\0\1\1\0#\0\0\0\26\0\0\0\27\0\0\0\r\0006\0004\t\5\t\6\t\4\4\3\5\3\6\3\10\7\10\10\10\32\10\33\10\34\10\t\10\n\10\v\10\4\10\5\10\6\4\1\5\1\6\1\3\3\3\1\3\2\4\2\5\2\6\2\0+\0\5\4\3\4\3\3\0-\0\2\1\1\0003\4\352\4\350\21\354\4\300ic\304\2523j\334\371\252R\304\34Q\205\t\373\374\5\240glP\226\270\334I\216\376z@\353\360\265\231h\305zS9\361lq9\331\6\3539\221\364\201\272\23\26\233<;l\2362\226\334\2)\221\2066\36\\\1@\313\3Is\313\0\227\35\251\347\264=\340G\220 }G\27\216O\326_\333cx\336\231N\260\312k\203\243\266,a`\27\210!\203f\n@$b\231\232$M`_\vC\23\213\\\257\234%\202\360d{\313\207q)D\223x\320uP\226\21\0\212\264\207\374O\220\305C\v\240\216x\232\307\364\231\245\"\301\\\236\230y\203\347\301JI\177\260T\206\254\201H\355\20\307\342\303]\33|\264\366jE\\\205\300BUxk\200\277`\366#\306\v2\211\253z4\3116z\232f\200e"..., 1552) = -1 EAGAIN (Ressource temporairement non disponible)
38200 03:17:55.619028 poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=13, events=POLLIN}, {fd=14, events=POLLIN}, {fd=15, events=POLLIN}, {fd=16, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=19, events=POLLIN}, {fd=20, events=POLLIN}, {fd=21, events=POLLIN}, {fd=22, events=POLLIN}, {fd=23, events=POLLIN}, {fd=24, events=POLLIN}, {fd=25, events=POLLIN}, {fd=27, events=POLLIN}, {fd=28, events=POLLIN}, {fd=29, events=POLLIN}, {fd=30, events=POLLIN|POLLOUT}, {fd=31, events=POLLIN}, {fd=32, events=POLLIN}, {fd=33, events=POLLIN}, {fd=34, events=POLLIN}, {fd=35, events=POLLIN}, {fd=36, events=POLLIN}, {fd=37, events=POLLIN}, {fd=38, events=POLLIN}, {fd=39, events=POLLIN}, {fd=40, events=POLLIN}, {fd=41, events=POLLIN}, {fd=42, events=POLLIN}, {fd=43, events=POLLIN}, {fd=44, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=47, events=POLLIN}, {fd=48, events=POLLIN}, {fd=50, events=POLLIN}], 43, 1) = 0 (Timeout)
38200 03:17:55.620481 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=417134760}) = 0
38200 03:17:55.620615 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=417329337}) = 0
...
38200 03:17:55.623450 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=420271935}) = 0

It looks like poll timeouts after 1ms and tries to send again the same block of data on the same file descriptor. Which is still not ready. The whole ordeal repeats every few ms.

For what it's worth, the CPU is an AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55.
My znc config has 29 users and 31 networks.
The modules loaded on at least some of the configured networks: autocycle bouncedcc buffextras chansaver clearbufferonmsg controlpanel corecaps identfile kickrejoin lastseen nickserv perform sasl savebuff stickychan

The output of lsof -np 38200 for the file descriptor znc tries to write to in this loop.

znc     38200 celelibi  30u  IPv4 13079868      0t0     TCP 192.168.0.1:34073->116.203.208.133:6660 (SYN_SENT)

The network it's trying to connect to is long dead. The address is irc.epd-me.net +6660.

I'm on Debian trixie and my znc version is:

ZNC 1.9.1+deb2+b3 - https://znc.in
IPv6: yes, SSL: yes, DNS: threads, charset: yes, i18n: yes, Argon2: yes

Hope this helps.

Hi, Recently, znc started using about 20% CPU (as seen from htop) when doing nothing. Here's the loop znc is stuck into as seen by strace (shortened a bit for readability); ``` 38200 03:17:55.613288 write(30, "\26\3\1\6\v\1\0\6\7\3\3\343\240N\272\320I\25C\242;\327Z\223\20\341P\200\312\210=|*\255\347\305F\267\355(\216\346j \24\7\266\311\334\237\356\250X\230h\362bG(nW\262\325\246^\231\271\31|\275\30\222\361G\361\354\08\23\2\23\3\23\1\300+\300/\300,\3000\314\251\314\250\0\236\0\237\314\252\300#\300'\300\t\300\23\300$\300(\300\n\300\24\0g\0k\0\234\0\235\0<\0=\0/\0005\1\0\5\206\377\1\0\1\0\0\0\0\23\0\21\0\0\16irc.epd-me.net\0\v\0\4\3\0\1\2\0\n\0\22\0\20\21\354\0\35\0\27\0\36\0\30\0\31\1\0\1\1\0#\0\0\0\26\0\0\0\27\0\0\0\r\0006\0004\t\5\t\6\t\4\4\3\5\3\6\3\10\7\10\10\10\32\10\33\10\34\10\t\10\n\10\v\10\4\10\5\10\6\4\1\5\1\6\1\3\3\3\1\3\2\4\2\5\2\6\2\0+\0\5\4\3\4\3\3\0-\0\2\1\1\0003\4\352\4\350\21\354\4\300ic\304\2523j\334\371\252R\304\34Q\205\t\373\374\5\240glP\226\270\334I\216\376z@\353\360\265\231h\305zS9\361lq9\331\6\3539\221\364\201\272\23\26\233<;l\2362\226\334\2)\221\2066\36\\\1@\313\3Is\313\0\227\35\251\347\264=\340G\220 }G\27\216O\326_\333cx\336\231N\260\312k\203\243\266,a`\27\210!\203f\n@$b\231\232$M`_\vC\23\213\\\257\234%\202\360d{\313\207q)D\223x\320uP\226\21\0\212\264\207\374O\220\305C\v\240\216x\232\307\364\231\245\"\301\\\236\230y\203\347\301JI\177\260T\206\254\201H\355\20\307\342\303]\33|\264\366jE\\\205\300BUxk\200\277`\366#\306\v2\211\253z4\3116z\232f\200e"..., 1552) = -1 EAGAIN (Ressource temporairement non disponible) 38200 03:17:55.613485 poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=13, events=POLLIN}, {fd=14, events=POLLIN}, {fd=15, events=POLLIN}, {fd=16, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=19, events=POLLIN}, {fd=20, events=POLLIN}, {fd=21, events=POLLIN}, {fd=22, events=POLLIN}, {fd=23, events=POLLIN}, {fd=24, events=POLLIN}, {fd=25, events=POLLIN}, {fd=27, events=POLLIN}, {fd=28, events=POLLIN}, {fd=29, events=POLLIN}, {fd=30, events=POLLIN|POLLOUT}, {fd=31, events=POLLIN}, {fd=32, events=POLLIN}, {fd=33, events=POLLIN}, {fd=34, events=POLLIN}, {fd=35, events=POLLIN}, {fd=36, events=POLLIN}, {fd=37, events=POLLIN}, {fd=38, events=POLLIN}, {fd=39, events=POLLIN}, {fd=40, events=POLLIN}, {fd=41, events=POLLIN}, {fd=42, events=POLLIN}, {fd=43, events=POLLIN}, {fd=44, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=47, events=POLLIN}, {fd=48, events=POLLIN}, {fd=50, events=POLLIN}], 43, 1) = 0 (Timeout) 38200 03:17:55.615005 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=411690538}) = 0 38200 03:17:55.615196 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=411847959}) = 0 ... 38200 03:17:55.618688 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=415336153}) = 0 38200 03:17:55.618838 write(30, "\26\3\1\6\v\1\0\6\7\3\3\343\240N\272\320I\25C\242;\327Z\223\20\341P\200\312\210=|*\255\347\305F\267\355(\216\346j \24\7\266\311\334\237\356\250X\230h\362bG(nW\262\325\246^\231\271\31|\275\30\222\361G\361\354\08\23\2\23\3\23\1\300+\300/\300,\3000\314\251\314\250\0\236\0\237\314\252\300#\300'\300\t\300\23\300$\300(\300\n\300\24\0g\0k\0\234\0\235\0<\0=\0/\0005\1\0\5\206\377\1\0\1\0\0\0\0\23\0\21\0\0\16irc.epd-me.net\0\v\0\4\3\0\1\2\0\n\0\22\0\20\21\354\0\35\0\27\0\36\0\30\0\31\1\0\1\1\0#\0\0\0\26\0\0\0\27\0\0\0\r\0006\0004\t\5\t\6\t\4\4\3\5\3\6\3\10\7\10\10\10\32\10\33\10\34\10\t\10\n\10\v\10\4\10\5\10\6\4\1\5\1\6\1\3\3\3\1\3\2\4\2\5\2\6\2\0+\0\5\4\3\4\3\3\0-\0\2\1\1\0003\4\352\4\350\21\354\4\300ic\304\2523j\334\371\252R\304\34Q\205\t\373\374\5\240glP\226\270\334I\216\376z@\353\360\265\231h\305zS9\361lq9\331\6\3539\221\364\201\272\23\26\233<;l\2362\226\334\2)\221\2066\36\\\1@\313\3Is\313\0\227\35\251\347\264=\340G\220 }G\27\216O\326_\333cx\336\231N\260\312k\203\243\266,a`\27\210!\203f\n@$b\231\232$M`_\vC\23\213\\\257\234%\202\360d{\313\207q)D\223x\320uP\226\21\0\212\264\207\374O\220\305C\v\240\216x\232\307\364\231\245\"\301\\\236\230y\203\347\301JI\177\260T\206\254\201H\355\20\307\342\303]\33|\264\366jE\\\205\300BUxk\200\277`\366#\306\v2\211\253z4\3116z\232f\200e"..., 1552) = -1 EAGAIN (Ressource temporairement non disponible) 38200 03:17:55.619028 poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=13, events=POLLIN}, {fd=14, events=POLLIN}, {fd=15, events=POLLIN}, {fd=16, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=19, events=POLLIN}, {fd=20, events=POLLIN}, {fd=21, events=POLLIN}, {fd=22, events=POLLIN}, {fd=23, events=POLLIN}, {fd=24, events=POLLIN}, {fd=25, events=POLLIN}, {fd=27, events=POLLIN}, {fd=28, events=POLLIN}, {fd=29, events=POLLIN}, {fd=30, events=POLLIN|POLLOUT}, {fd=31, events=POLLIN}, {fd=32, events=POLLIN}, {fd=33, events=POLLIN}, {fd=34, events=POLLIN}, {fd=35, events=POLLIN}, {fd=36, events=POLLIN}, {fd=37, events=POLLIN}, {fd=38, events=POLLIN}, {fd=39, events=POLLIN}, {fd=40, events=POLLIN}, {fd=41, events=POLLIN}, {fd=42, events=POLLIN}, {fd=43, events=POLLIN}, {fd=44, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=47, events=POLLIN}, {fd=48, events=POLLIN}, {fd=50, events=POLLIN}], 43, 1) = 0 (Timeout) 38200 03:17:55.620481 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=417134760}) = 0 38200 03:17:55.620615 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=417329337}) = 0 ... 38200 03:17:55.623450 clock_gettime(CLOCK_MONOTONIC, {tv_sec=703729, tv_nsec=420271935}) = 0 ``` It looks like poll timeouts after 1ms and tries to send again the same block of data on the same file descriptor. Which is still not ready. The whole ordeal repeats every few ms. For what it's worth, the CPU is an `AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55`. My znc config has 29 users and 31 networks. The modules loaded on at least some of the configured networks: autocycle bouncedcc buffextras chansaver clearbufferonmsg controlpanel corecaps identfile kickrejoin lastseen nickserv perform sasl savebuff stickychan The output of `lsof -np 38200` for the file descriptor znc tries to write to in this loop. ``` znc 38200 celelibi 30u IPv4 13079868 0t0 TCP 192.168.0.1:34073->116.203.208.133:6660 (SYN_SENT) ``` The network it's trying to connect to is long dead. The address is `irc.epd-me.net +6660`. I'm on Debian trixie and my znc version is: ``` ZNC 1.9.1+deb2+b3 - https://znc.in IPv6: yes, SSL: yes, DNS: threads, charset: yes, i18n: yes, Argon2: yes ``` Hope this helps. <!-- github-sync-id:3070195006 -->
adam closed this issue 2026-10-05 05:01:12 +02:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#1065