Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnexpectedValueException: Expected NET_SFTP_NAME or NET_SFTP_STATUS. Got packet type:: #1945

Open
shuvam07 opened this issue Sep 22, 2023 · 5 comments

Comments

@shuvam07
Copy link

I am trying to list contents from a server directory using an SFTP connection, and sometimes it just throws this error

UnexpectedValueException: Expected NET_SFTP_NAME or NET_SFTP_STATUS. Got packet type::

This issues is happening intermittently. I have attached the screenshot of the timeframe when its happening. I am using this connection for a long time now (almost 5 months), but this issues has started up showing recently. I am using phpseclib version 3.0.19

Screenshot 2023-09-22 at 14 48 40
@terrafrost
Copy link
Member

I apologize for the delay - I've been vacationing in Canada and Washington for the past ten days and am flying back today.

Anyway, can you post the logs? You can get them by doing define('NET_SFTP_LOGGING', 2); at the top and then echo $sftp->getSFTPLog() after the error is encountered.

Thanks!

@michaellehmkuhl
Copy link

@terrafrost I'm attaching a log from one of these instances. Hope this helps to solve the issue. It's causing quite a bit of random disruption in production for our application.
sftp-unexpectedvalueexception-phpseclib-issue-1945.log

@terrafrost
Copy link
Member

@michaellehmkuhl - so it looks like, if anything, you're getting a UnexpectedValueException: Expected NET_SFTP_DATA or NET_SFTP_STATUS. Got packet type:: error. ie. NET_SFTP_DATA instead of NET_SFTP_STATUS.

It would be interesting to see your SSH logs as well. Like what is your SSH server and are you getting any errors at the SSH layer after phpseclib sends that last NET_SFTP_READ request? In lieu of knowing that I do wonder if define('NET_SFTP_QUEUE_SIZE', 1); might help, for your situation.

@michaellehmkuhl
Copy link

Thanks for the tip, @terrafrost! We'll give that a try.

@AlikDex
Copy link

AlikDex commented Dec 17, 2023

Hi, guys. I want to share my experience. Maybe it help you.

I also often had the same error. I ran a disk check. It turned out that there are a lot of bad sectors. And because of that the file writing was interrupted. With the same error.

After contacting customer service, the disk was replaced. The error also disappeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants