Skip to content

Limit simultaneous SFTP source connections when using wildcard streams #695

@akkce

Description

@akkce

Sling version:

1.5.1

What is the Operating System?

Linux

Do you have a CLI Pro/Platform subscription?

No

Description of the issue

I'm trying to build a sling Replication that will connect to our vendor's SFTP server and download all the files located there. There should be at most 150-ish files, the largest set of 7 are 21000 KB in size, but the vast majority of the files are much smaller (2400 KB or less).

It appears that sling opening too many SFTP connections for the server - after we get to about 15+ connections established (determined via ss -tn | grep), I get the following error (which I'm guessing is the server killing all the open connections)

Some google-ing led me to think that I could set a max_connections variable in the stream but if it appears to be a no-op.

How can I go about performing this task without swamping the SFTP server in connections?

Replication Configuration

source: SFTP
target: MARIADB

defaults:
  mode: full-refresh
  object: 'slingETL.{stream_file_path}'
  columns:
    "*": string
  source_options:
    format: csv
    delimiter: "\t"

streams:
  "/Upload/*.txt":
    source_options:
      limit: 100
      max_connections: 2

Log Output

2026-01-08 12:35:20 DBG opened "sftp" connection (conn-sftp-56e)
fatal:
--- proc.go:283 main ---
--- sling_cli.go:525 main ---
--- sling_cli.go:561 cliInit ---
--- cli.go:287 CliProcess ---
--- sling_run.go:275 processRun ---
--- sling_run..go:87 RunReplication ---
--- sling_run.go:529 replicationRun ---
--- replication.go:1175 Compile ---
--- replication.go:1356 StreamToTaskConfig ---
~ failure running replication (see docs @ https://docs.slingdata.io/sling-cli)
--- config.go:634 Prepare ---
~ Error compiling replication config
--- config.go:822 FormatTargetObjectName ---
~ could not prepare stream config: /Upload/FILE.txt
--- config.go:1041 GetFormatMap ---
~ could not prepare stream task: /Upload/FILE.txt
--- connection.go:362 AsFile ---
~ could not format target object name
--- connection.go:385 AsFileContext ---
~ could not get formatting variables
--- fs.go:162 NewFileSysClientFromURLContext ---
~ could not init source conn as file
--- fs.go:130 NewFileSysClientContext ---
~ Error initiating File Sys Client
--- fs_sftp.go:30 Init ---
~ unable to connect to ssh server
--- fs_sftp.go:115 Connect ---
~ unable to connect to ssh server sftp1.myvendor.com:22
--- ssh.go:142 Connect ---
ssh: handshake failed: read tcp SLING_SERVER_IP:50328->SFTP_SERVER_IP:22: read: connection reset by peer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions