#1170 Prosody keeps the fd of DNS requests open

Reporter Link Mauve
Owner Zash
Created
Updated
Stars ★ (1)
Tags
  • Priority-Medium
  • Type-Defect
  • Milestone-0.10
  • Status-Fixed
  1. Link Mauve on

    What steps will reproduce the problem? 1. Let Prosody do DNS requests. What is the expected output? Prosody does the DNS requests, and work forever. What do you see instead? Prosody runs out of fds, keeping all of the UDP sockets to my resolver open. What version of the product are you using? On what operating system? Trunk version 0bb46a1bb398, on ArchLinux. Please provide any additional information below. This didn’t seem to be happening on a version a few months older.

  2. Zash on

    Thanks for the report. This is most likely because net.server holds on to all sockets until they are explicitly closed.

    Changes
    • tags Milestone-0.10 Status-Accepted
  3. Zash on

    diff -r 144666d0ad2f -r c46c2942b8fe plugins/mod_s2s/mod_s2s.lua --- a/plugins/mod_s2s/mod_s2s.lua Sun Jun 10 17:45:49 2018 +0200 +++ b/plugins/mod_s2s/mod_s2s.lua Sun Jun 17 20:02:40 2018 +0200 @@ -206,6 +206,9 @@ function mark_connected(session) session.sendq = nil; end + if session.resolver then + session.resolver._resolver:closeall() + end session.resolver = nil; session.ip_hosts = nil; session.srv_hosts = nil;

    Changes
    • owner Zash
    • tags Status-Started Patch
  4. Zash on

    I'm wondering if a session that is destroyed before reaching the above will leak the session (until the read-timeout).

  5. Zash on

    Pushed the above patch as https://hg.prosody.im/0.10/rev/c46c2942b8fe While this probably takes care of the majority of cases, I'm not centain that it is a complete fix. Need to investigate what happens if a session fails to connect.

    Changes
    • tags Patch Status-NeedInfo
  6. Zash on

    Assuming that fixed it.

    Changes
    • tags Status-Fixed
  7. Zash on

    Switching to the new net.connect API for s2s has resulted in a regression of this issue, see #1429

New comment

Not published. Used for spam prevention and optional update notifications.