View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0006654 | unreal | ircd | public | 2026-11-04 14:56 | 2026-11-26 10:46 |
| Reporter | Dragone2 | Assigned To | syzop | ||
| Priority | high | Severity | major | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | 6.2.7 | ||||
| Fixed in Version | 6.2.8 | ||||
| Summary | 0006654: Webserver/WebSocket behind nginx: invalid fd in fd table (BUG_FD_SETSELECT_OUT_OF_RANGE) and epoll_ctl failure on fd 0 | ||||
| Description | When UnrealIRCd 6.2.7 runs with webserver and websocket behind nginx, the IRCd repeatedly logs: io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 383379216 in fd table, but MAXCONNECTIONS is 16384 Later it also logs: io.EPOLL_CTL_FAILED [error] [io] fd_refresh(): epoll_ctl returned error for fd 0 (): Operation not permitted The invalid file descriptor value strongly suggests an uninitialized, stale, or otherwise invalid pointer/handle is being passed to the fd/epoll code. This appears related to the webserver/WebSocket listener and/or reverse-proxy handling, rather than to MAXCONNECTIONS being reached. This problem causes various clients, already connected to the IRCd, to be disconnected randomically and can cause a block. | ||||
| Steps To Reproduce | Compile UnrealIRCd 6.2.7 on Debian 13: Kernel: 6.12.113+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.113-1 (2026-10-15) x86_64 GNU/Linux Load webserver and websocket. Configure a local TLS WebSocket listener on 127.0.0.1:8000. Put nginx on port 443 and proxy WebSocket traffic to https://127.0.0.1:8000/. Use a WebSocket IRC client through nginx. During normal WebSocket usage, observe repeated BUG_FD_SETSELECT_OUT_OF_RANGE errors and later EPOLL_CTL_FAILED. | ||||
| Additional Information | Observed behavior At 09:14:34, the same invalid fd is modified many times: io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 383379216 in fd table, but MAXCONNECTIONS is 16384 At 13:07:57: io.EPOLL_CTL_FAILED [error] [io] fd_refresh(): epoll_ctl returned error for fd 0 (): Operation not permitted Separately, the server repeatedly reports: flood.SENDQ_EXCEEDED [info] Flood of queued data to [] exceeds class::sendq (3000008 > 3000000) The sendq messages may be a consequence of nginx closing/stalling proxied WebSocket connections, but the invalid fd and epoll errors look like separate IRCd-side defects. Relevant configuration The WebSocket listener is: loadmodule "websocket"; loadmodule "webserver"; listen { ip 127.0.0.1; port 8000; options { tls; websocket { type binary; } } tls-options { certificate "/etc/letsencrypt/live/example.org/fullchain.pem"; key "/etc/letsencrypt/live/example.org/privkey.pem"; options { no-client-certificate; } } } proxy nginx { type x-forwarded; match { ip 127.0.0.1; } } nginx proxies HTTPS WebSocket traffic to UnrealIRCd: location / { proxy_pass https://127.0.0.1:8000/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; 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-Forwarded-Proto $scheme; proxy_read_timeout 60s; proxy_send_timeout 60s; proxy_connect_timeout 30s; proxy_buffering off; proxy_request_buffering off; tcp_nodelay on; } Notes for developers The reported fd, 383379216, is far beyond MAXCONNECTIONS (16384) and looks like a corrupted or misinterpreted value rather than a legitimate descriptor. The subsequent epoll_ctl failure on fd 0 may indicate that an invalid connection/context is retained after a WebSocket/proxy disconnect. The problem occurs with nginx in front of the WebSocket listener; direct IRC connections may not show the same behavior. UnrealIRCd’s current proxy documentation recommends the standardized forwarded proxy type for nginx, while this setup uses type x-forwarded; it would be useful to test whether the bug is specific to x-forwarded, but the invalid fd value suggests a deeper webserver/WebSocket issue. nginx requires explicit Upgrade and Connection headers for WebSocket proxying; these are present. Its default 60-second idle timeout can close proxied WebSocket connections, which may explain the SENDQ_EXCEEDED entries. Additional information UnrealIRCd version: 6.2.7 OS: Debian 13 Architecture: x86_64 Reverse proxy: nginx WebSocket type: binary Listener: 127.0.0.1:8000, TLS nginx listener: 443, TLS, HTTP/2 enabled The SENDQ_EXCEEDED value is consistently 3000008 > 3000000, suggesting a connection/class with a 3 MB sendq, likely not one of the classes shown in the pasted main config. | ||||
| 3rd party modules | |||||
|
|
Update: the IRCd is using 100% CPU, CPU Time: 1d02h17m right now. The server has just 16 clients. |
|
|
Hi Dragone, Thank you for reporting the bug. And doing so privately :) You have a hit bug that is probably already in my queue for 6.2.8. It fixes an issue with websockets if a (trusted) reverse proxy is used. It won't be in the 6.2.7.1 fixes of Saturday, those are other fixes. I will share the fix with you somewhere in the next few days, okay? And/or tweak it to make it work for you. Or if i didn't (i forgot) then feel free to bump me here. I got so much on my mind with the 6.2.7.1 / hot-patch stuff at the moment :\ Thanks! Bram |
|
|
Hello syzop, It's been a while and I wanted to inform you that since the release of UnrealIRCd 6.2.7.1 the issue didn't happen again (I upgraded it on 2026-11-07). Maybe you fixed something with the new release? Or it's just random? I'll keep it monitored, thanks for your work :) |
|
|
Well, it's pretty funny, it happened again today: --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1150814736 in fd table, but MAXCONNECTIONS is 16384 --- flood.SENDQ_EXCEEDED [info] Flood of queued data to [] exceeds class::sendq (3000008 > 3000000) (Too much data queued to be sent to this client) Because I rehashed the server configuration some hours before. |
|
|
Hi Dragone2, Thanks for bumping me as requested, this was indeed necessary :D I forgot to tell you that the fix is in 6.2.8-rc1. So if you have some time to try that version and let me know if you have any (similar) issues, that would be appreciated. The 6.2.8 stable release is scheduled for next weekend, so is pretty close too. You could also wait for that so you don't have to upgrade twice: 6.2.8 will have more (other) fixes than 6.2.8-rc1. Regards, Bram |
|
|
Dear syzop, Thank you very much, I've upgraded to the RC1, so I can check for bugs/issues. Have a nice day! |
|
|
Great, thank you! |
|
|
Ehy, Hi again. Unfortunately, after the upgrade, the problem is still here: This morning: -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 -[11:45:45]- -irc.risposteinformatiche.it- flood.SENDQ_EXCEEDED [info] Flood of queued data to [] exceeds class::sendq (3000008 > 3000000) (Too much data queued to be sent to this client) -[12:51:37]- -irc.risposteinformatiche.it- commandsno.COMMANDSNO_USAGE [info] [email protected] used command VERSION (params: <none>) - -[12:51:37]- UnrealIRCd-6.2.8-rc1. irc.risposteinformatiche.it Fhn6OoE3 [Linux web-server 6.12.113+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.113-1 (2026-10-15) x86_64=6100] - -[12:51:37]- -irc.risposteinformatiche.it- OpenSSL 3.5.9 29 Sep 2026 -[12:51:37]- -irc.risposteinformatiche.it- libsodium 1.0.22 -[12:51:37]- -irc.risposteinformatiche.it- c-ares 1.34.8 -[12:51:37]- -irc.risposteinformatiche.it- PCRE2 10.46 2025-08-27 -[12:51:37]- -irc.risposteinformatiche.it- jansson 2.15.0 - -[12:51:37]- ACCOUNTEXTBAN=account,a AWAYLEN=307 BOT=B CASEMAPPING=ascii CHANLIMIT=#:20 CHANMODES=beI,fkL,lFH,cdimnprstzCDGKMNOPQRSTVZ CHANNELLEN=32 CHANTYPES=# CHATHISTORY=50 CLIENTTAGDENY=*,-draft/react,-draft/typing,-typing,-draft/channel-context,-draft/reply,-reply DEAF=d ELIST=MNUCT are supported by this server -[12:51:37]- EXCEPTS EXTBAN=~,acfijmnpqrtACFGOST INVEX KICKLEN=307 KNOCK MAP MAXLIST=b:60,e:60,I:60 MAXNICKLEN=30 MINNICKLEN=0 MODES=12 MONITOR=128 MSGREFTYPES=msgid,timestamp are supported by this server -[12:51:37]- NAMELEN=50 NAMESX NETWORK=RisposteInformatiche NICKLEN=30 PREFIX=(qaohv)~&@%+ QUITLEN=307 SAFELIST SILENCE=15 STATUSMSG=~&@%+ TARGMAX=DCCALLOW:,ISON:,JOIN:,KICK:4,KILL:,LIST:,NAMES:1,NOTICE:1,PART:,PRIVMSG:4,SAJOIN:,SAPART:,TAGMSG:1,USERHOST:,USERIP:,WATCH:,WHOIS:1,WHOWAS:1 TOPICLEN=360 UHNAMES are supported by this server -[12:51:37]- USERIP WALLCHOPS WATCH=128 WATCHOPTS=A WHOX are supported by this server After ./unrealircd stop + waiting some seconds and ./unrealircd start: -[15:14:13]- -irc.risposteinformatiche.it- io.EPOLL_CTL_FAILED [error] [io] fd_refresh(): epoll_ctl returned error for fd 0 (): Operation not permitted -[15:14:13]- -irc.risposteinformatiche.it- flood.SENDQ_EXCEEDED [info] Flood of queued data to [] exceeds class::sendq (3000008 > 3000000) (Too much data queued to be sent to this client) Steps to reproduce the issue: 1. Upgrade to RC1 2. ./unrealircd restart 3. connect via websocket proxied by nginx 4. wait and you'll see something like io.BUG_FD_SETSELECT_OUT_OF_RANGE [error] [BUG] trying to modify fd 1631701152 in fd table, but MAXCONNECTIONS is 16384 or io.EPOLL_CTL_FAILED [error] [io] fd_refresh(): epoll_ctl returned error for fd 0 (): Operation not permitted To accelerate the issue: 1. Just do a rehash 2. connect via websocket proxied by nginx 3. disconnect and wait, you'll see io.EPOLL_CTL_FAILED [error] [io] fd_refresh(): epoll_ctl returned error for fd 0 (): Operation not permitted in some minutes Let me know if you need more information from me |
|
|
Thank you, I have found the issue. To trigger this bug one needs: 1) using a proxy block, 2) ident checks need to be enabled, 3) you need to have rehashed at least once So it took a moment to find it :D I'll put a fix in git soon. I will let you know when it is in, maybe tomorrow :) |
|
|
Fixed in https://github.com/unrealircd/unrealircd/commit/9014684b09ae1063498bb93c3ae644baee06e6b7 Thanks Dragone, and double thanks for testing with the release candidate. If you hadn't checked the release candidate, this bug would still have been in the release :-) commit 9014684b09ae1063498bb93c3ae644baee06e6b7 (HEAD -> unreal60_dev) Author: Bram Matthys <[email protected]> Date: Wed Nov 25 06:21:05 2026 +0100 Fix weird errors when using a proxy block + ident check + REHASHing once, and potentially a crash. Signs were things like [BUG] trying to modify fd 1636432642 in fd table, io.EPOLL_CTL_FAILED [error] [io] fd_refresh(): epoll_ctl returned error. This had to do with efunctions_switchover() not taking PERM modules into account, so fallback functions were used instead of actual functions for things like cancel_ident_lookup(). This also fixes set REPUTATION in an action doing nothing. Reported by Dragone2 in https://bugs.unrealircd.org/view.php?id=6654 diff --git a/src/api-efunctions.c b/src/api-efunctions.c index 93333000f..0dbceff5f 100644 --- a/src/api-efunctions.c +++ b/src/api-efunctions.c @@ -367,7 +367,7 @@ void efunctions_switchover(void) int found = 0; for (e = Efunctions[i]; e; e = e->next) { - if (e->willberemoved) + if (e->willberemoved && !(e->owner->options & MOD_OPT_PERM)) continue; if (!efunction_table[i].funcptr) { |
|
|
This is fixed and this bug report can now be public, so i changed private->public. The only thing I did was make some of your comments 'private' as they contained sensitive data (eg IPs of users, of very specific config, etc) Thanks again for your help :) |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-11-04 14:56 | Dragone2 | New Issue | |
| 2026-11-04 14:56 | Dragone2 | File Added: nginx-irc.example.org.conf | |
| 2026-11-04 14:56 | Dragone2 | File Added: unrealircd.conf | |
| 2026-11-05 12:05 | Dragone2 | Note Added: 0023717 | |
| 2026-11-05 19:01 | syzop | Note Added: 0023720 | |
| 2026-11-05 19:02 | syzop | Note Edited: 0023720 | |
| 2026-11-19 10:44 | Dragone2 | Note Added: 0023746 | |
| 2026-11-19 14:39 | Dragone2 | Note Added: 0023747 | |
| 2026-11-22 07:19 | syzop | Note Added: 0023749 | |
| 2026-11-22 07:19 | syzop | Assigned To | => syzop |
| 2026-11-22 07:19 | syzop | Status | new => feedback |
| 2026-11-22 07:20 | syzop | Note Edited: 0023749 | |
| 2026-11-22 20:01 | Dragone2 | Note Added: 0023750 | |
| 2026-11-23 09:32 | syzop | Note Added: 0023751 | |
| 2026-11-23 15:18 | Dragone2 | Note Added: 0023752 | |
| 2026-11-24 20:30 | syzop | Note Added: 0023753 | |
| 2026-11-25 06:35 | syzop | Note Added: 0023754 | |
| 2026-11-26 08:59 | syzop | File Deleted: nginx-irc.example.org.conf | |
| 2026-11-26 08:59 | syzop | File Deleted: unrealircd.conf | |
| 2026-11-26 08:59 | syzop | Status | feedback => resolved |
| 2026-11-26 08:59 | syzop | Resolution | open => fixed |
| 2026-11-26 08:59 | syzop | Fixed in Version | => 6.2.8 |
| 2026-11-26 10:45 | syzop | View Status | private => public |
| 2026-11-26 10:46 | syzop | Note Added: 0023757 | |
| 2026-11-26 10:46 | syzop | Note Edited: 0023757 |