mardi 31 janvier 2017

Laravel and league/flysystem-sftp: Connection closed prematurely

I'll start from the problem and give some additional info then. So the problem is that the SFTP filesystem stops working in 1 day after the process is started. The error it returns is:

Connection closed prematurely /var/www/html/hub/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php(2906)

My Laravel app listens on a Redis channel, converts the received data into a CSV file and uploads it through SFTP to another server using the league/flysystem-sftp library. The process that listens/converts in long-living, controlled by supervisor.

All these manipulations are performed by a separate composer package. Originally I passed instances of the connections directly to the package through the service provider of the main app and I though this was the root of the problem:

$sageExportFacade->setDisks(
Storage::disk('sage_local'),
Storage::disk('sage_remote')
);

The code was changed so that it passes callbacks that resolve the connection instances every time the component needs them:

$hubMonitorFacade->setSageFtpDisk(
            function (): FilesystemAdapter {
                return Storage::disk('sage_remote');
            })->setWmsFtpDisk(
            function (): FilesystemAdapter {
                return Storage::disk('wms');
            }
        );

No luck. The first day it's working just fine, the second day in the morning it crashes saying "Connection closed prematurely". Any idea what it could be?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire