[Bug 3538] New: Sshd reported error:Bind to port 22 failed because of Address already in use

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Mon Feb 13 14:05:03 AEDT 2023


https://bugzilla.mindrot.org/show_bug.cgi?id=3538

            Bug ID: 3538
           Summary: Sshd reported error:Bind to port 22 failed because of
                    Address already in use
           Product: Portable OpenSSH
           Version: 9.1p1
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: sshd
          Assignee: unassigned-bugs at mindrot.org
          Reporter: rmsh1216 at 163.com

When I run "systemctl restart sshd", the sshd service reported an
error: Bind to port 22 failed because of Address already in use. Why
the address is in use in this case is that the close() system call is
asynchronous. The kernel implementation of close is to put the real
close work in a work queue and wait for the system to schedule. When
the system is busy, closing the socket may be delayed, and restarting
the sshd service would cause this error.

the call stack of close() is as shown below

close(fd) // sshd calls close()
    SYSCALL_DEFINE1(close, unsigned int, fd); // kernel code
        __close_fd(current->files, fd);
            filp_close(filp,id);
                fput(filp); // put the next work in an work queue
                return retval; // return without confirming


I don't know if it's a problem and if it is, how to solve it?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list