login about faq

This error was received when trying to write to a file opened via the SFtp.OpenFile method:

StatusCode: 4
StatusMessage: Requested operation is invalid.
Failed to get write status replies (1)

asked Oct 29 '12 at 10:36

chilkat's gravatar image

chilkat ♦♦

The problem with most SSH/SFTP server error messages is that no information is provided. This would be an easily solved problem if the SSH server indicated WHY the operation was invalid.

The cause was determined after a lengthy investigation with the customer that experienced this problem. It turns out that a server-side file watcher process was running that locks a file when it appears. An SFTP client uploads a file by (1) opening it, (2) writing data to it, and (3) closes it. The act of opening the file creates it on the server. At this point, the file watcher process notices the new file an immediately locks it. The client-side proceeds by trying to write to the opened file, but fails because it is now locked. The "operation is invalid" turned out to be a "file is locked by another process".

It should be noted that this was a race condition: If the client can open the file, write to it, and close it quickly enough, before the file is noticed by the file watcher, then no error occurs.


answered Oct 29 '12 at 10:43

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Oct 29 '12 at 10:36

Seen: 1,527 times

Last updated: Oct 29 '12 at 10:43

powered by OSQA