apache / apache/mina-ftpserver

Concurrent active mode FTP transfers fail when setting a static "data port"

Open
#34 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
67
Forks
38
PR merge metrics
No merged PRs in 30d

Description

When configuring the "local-port" element within the /res/conf/ftpd-*.xml file to a static value, then the ability to run parallel active FTP transfers is lost, and results in an immediate "425" error for the other concurrent transfer attempts.
RE: https://mina.apache.org/ftpserver-project/configuration_listeners.html#active-element,

When "local-port" is not configured, then the active mode data-port connections default to sourcing from "any available port" on the ftp server. For example, by default, a Windows 2016 server may choose a dynamic source data-port of 61753 for one transfer when connecting back to the client at the location already specified by the client's PORT command, and a different data-port like 61234 for another parallel transfer.
Screenshot of test configuration:
apache-ftpserver 1 1 1 configuration using static source port

When using another FTP server such as vsftpd, we can run parallel active transfers, all sourcing from a FTP server data-port of 20.
In that case, we would configure the option "connect_from_port_20=YES" in vsftpd's config file (RE: http://vsftpd.beasts.org/vsftpd_conf.html), so the FTP server isn't choosing dynamic source ports when connecting back to the client PORT location.

I've tested this behavior with apache ftpserver v1.1.1, 1.1.4, and 1.2, and the behavior seems consistent among all of them.

In this screenshot, my "ftp-dev-01" server has an IP of 172.16.248.202.
When running a "10x parallel download" jmeter test, and running wireshark to inspect the responses, I see that the server only sends one SYN attempt from port 20 back to my client. I expect to see 10x SYN attempts. The one transfer succeeds, however the other 9 immediately return a "425" error:
![JMeter of 10x parallel active FTP DL's and wireshark showing only 1 SYN to client PORT](https://github.com/apache/mina-ftpserver/assets/160191970/bdb5b3e0-28e6-4000-be97-8484903c9008)

Attaching my jmeter 5.6.3 test, which uses 10 parallel threads to download a test.txt file from the server.
[ftp server concurrent download JMETER test.jmx.txt](https://github.com/apache/mina-ftpserver/files/14303672/ftp.server.concurrent.download.JMETER.test.jmx.txt)

If I switch the JMETER thread/iteration configuration to use 1 thread and 10 iterations (i.e. performing it serially), then all the downloads complete successfully, and all source from server port 20.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.