Skip to content

Close channel before trying to open again Exception is raised upon folder creation #1961

Description

@Naoray

I am using the flysystem-sftp-v3 in a Laravel app which uploads files to a SFTP server around 500times a month. Occasionally I get the error Please close the channel (256) before trying to open it again from SSH2::openChannel() when trying to run Storage::disk(’sftp’)->makeDirectory(‘folder_name’).

I tried to check the code to understand what the error means and how to avoid it, but I wasn’t able to figure it out myself. Can someone explain to me or point me in the right direction on when this happens and why?

    RuntimeException Please close the channel (256) before trying to open it again 
    vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php:2885 phpseclib3\Net\SSH2::openChannel
    vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php:550 phpseclib3\Net\SFTP::partial_init_sftp_connection
    vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php:624 phpseclib3\Net\SFTP::init_sftp_connection
    vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php:536 phpseclib3\Net\SFTP::precheck
    vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php:2931 phpseclib3\Net\SFTP::get_xstat_cache_prop
    vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php:2902 phpseclib3\Net\SFTP::get_stat_cache_prop
    vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php:2668 phpseclib3\Net\SFTP::is_dir
    vendor/league/flysystem-sftp-v3/SftpAdapter.php:112 League\Flysystem\PhpseclibV3\SftpAdapter::makeDirectory
    vendor/league/flysystem-sftp-v3/SftpAdapter.php:194 League\Flysystem\PhpseclibV3\SftpAdapter::createDirectory
    vendor/league/flysystem/src/Filesystem.php:95 League\Flysystem\Filesystem::createDirectory
    vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php:876 Illuminate\Filesystem\FilesystemAdapter::makeDirectory
    app/Jobs/UploadReleaseFolder.php:69 App\Jobs\UploadReleaseFolder::handle

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions