mtheall / ftpd

FTP Server for 3DS/Switch
GNU General Public License v3.0
1.41k stars 134 forks source link

451 Failed to listen on socket #110

Open eku opened 4 years ago

eku commented 4 years ago

Describe the bug After a certain number of transfer operations ftpd only reports "451 Failed to listen on socket".

To Reproduce Steps to reproduce the behavior:

  1. Start ftpd on 3DS
  2. Mount 3DS with curlftpfs on Linux
  3. Run rsync to synchronize local copy with 3DS SD card
  4. After a while error occures

Expected behavior I expect that transfers will continue to be possible regardless of the number of operations already performed.

Screenshots none

Platform (please complete the following information):

Additional context Mount options: -fstype=fuse,rw,allow_other,nodev,nonempty,noatime,disable_eprt,disable_epsv

BTW how can I configure ftpd to run on port 20/21 and use active ftp?

mtheall commented 4 years ago

I'm not having any luck recreating this issue. There should be a log message immediately before "451 Failed to listen on socket" that has more specific error message about the syscall to listen(2).

3DS network service does not allow apps to bind to ports less than 1024, so you can't configure it to use port 20/21.

The client decides whether to use active or passive ftp, so you'll have to consult curlftpfs.

eku commented 4 years ago

The log lines roll off the screen so quickly.

PASV
listen: Bad File Number
451 Failed to listen on socket

It looks to me as if no new sockets can be created. Are old sockets of passive connections not released? According to this https://www.chilkatsoft.com/p/p_390.asp the sockets might be in state TIME_WAIT.

The ftp server should use the response code 425 when resources are running low. See https://en.wikipedia.org/wiki/List_of_FTP_server_return_codes

eku commented 4 years ago

I have changed my script for synchronization so that it waits after an error 451. However, after the TIME_WAIT period of 2 minutes that has elapsed according to the TCP standard, new connections to ftpd should be possible again. But this is not the case.

mtheall commented 4 years ago

Sorry for the delay, but I will try adding a bunch of debug logs to get more information if you can recreate it. Do you run into this problem with the non-classic build? That one has a scrollable log.