Does SCP lock the file it is transfering?

Have a situation where we have an application log sitting out on an AIX server. The log is being continually written to from the application, and we have users on Windows who want to view the file. What they've been doing is using WinSCP to transfer the file to their desktop and they open it using a text editor.

What I think might be happening is scp is locking the file for the duration of the transfer, and the application ceases to be able to write to the file. The reason I believe this is the log file will stop growing at random points during the day.

Is that what perhaps is going on?


Why don't you try this. Start scp'ing a large file then run lsof /path/to/file on the AIX server and see what the FD column says.

From the lsof man page:

   FD         is the File Descriptor number of the file or:
                   cwd  current working directory;
                   Lnn  library references (AIX);
                   err  FD information error (see NAME column);
                   jld  jail directory (FreeBSD);
                   ltx  shared library text (code and data);
                   Mxx  hex memory-mapped type number xx.
                   m86  DOS Merge mapped file;
                   mem  memory-mapped file;
                   mmap memory-mapped device;
                   pd   parent directory;
                   rtd  root directory;
                   tr   kernel trace file (OpenBSD);
                   txt  program text (code and data);
                   v86  VP/ix mapped file;
              FD is followed by one of these characters, describing the mode under which the file is open:
                   r for read access;
                   w for write access;
                   u for read and write access;
                   space if mode unknown and no lock
                        character follows;
                   `-' if mode unknown and lock
                        character follows.
              The mode character is followed by one of these lock characters, describing the type of lock applied to the file:
                   N for a Solaris NFS lock of unknown type;
                   r for read lock on part of the file;
                   R for a read lock on the entire file;
                   w for a write lock on part of the file;
                   W for a write lock on the entire file;
                   u for a read and write lock of any length;
                   U for a lock of unknown type;
                   x for an SCO OpenServer Xenix lock on part of the file;
                   X for an SCO OpenServer Xenix lock on the entire file;
                   space if there is no lock.
              See the LOCKS section for more information on the lock information character.
              The FD column contents constitutes a single field for parsing in post-processing scripts.

If you do this, on Linux at least, you'll see that the FD column is "3r" which means it has some sort of read lock but I'm not sure what the 3 in front of it means.


Most Unix programs don't use locking or when they use it, it's not mandatory, so I doubt locking is stopping your log from growing. More likely the SCP transfer is slowing down the log writing.