Cannot commit via SFTP - file is locked

Bug #574200 reported by Frank Gifford on 2010-05-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

I set up an SFTP server using WinSSHD (free version). My client is able to status/checkout/branch fine, but is not able to commit after making changes. Both client & server are using Windows7.

For example, this works fine:
 c:\blah> bzr checkout sftp://userName@myIP:port/ProjectOne

But this does not work:
 c:\blah>bzr commit -m "checking in some edits"

Error message:
 Authentication (publickey) successful!
 Secsh channel 1 opened
 Committing to: sftp://userName@myIP:port/ProjectOne
 modified test.txt
 bzr: ERROR: the file could not be opened because it is locked by another process.

I cannot think of why/how anything on the server side is locked? Even a reboot of the server does not 'free' things up - same error message. The server is not running any anti-virus programs, and WinSSHD seems to have proper read/write access (for example I'm able to write over files when I SFTP into the server using the SFTP client program Tunnelier).

Here are the detailed results from the .bzr.log file:

Sun 2010-05-02 14:23:38 +0800
0.035 bazaar version: 2.1.1
0.035 bzr arguments: [u'commit', u'-m', u'commit from dave pc']
0.038 looking for plugins in C:/Users/Dave/AppData/Roaming/bazaar/2.0/plugins
0.038 looking for plugins in C:/Program Files/Bazaar/plugins
0.109 encoding stdout as sys.stdout encoding 'cp437'
0.139 opening working tree 'C:/Program Files/Bazaar/devBranch'
0.197 bzr-svn: using Subversion 1.6.6 ()
0.210 falling back to default implementation
0.210 failed to load system host keys: [Errno 2] No such file or directory: 'C:\\SPB_Data/.ssh/known_hosts'
[ 3728] 2010-05-02 14:23:38.223 INFO: Connected (version 2.0, client 1.04)
0.315 Trying SSH agent key 03B2CD139EDCCA062D92F55DF9BB28B1
[ 3728] 2010-05-02 14:23:38.361 INFO: Authentication (publickey) successful!
[ 3728] 2010-05-02 14:23:38.390 INFO: Secsh channel 1 opened.
[ 3728] 2010-05-02 14:23:38.461 INFO: [chan 1] Opened sftp connection (server version 3)
0.505 preparing to commit
[ 3728] 2010-05-02 14:23:38.645 INFO: Committing to: sftp://vieweng@
0.635 Selecting files for commit with filter None
[ 3728] 2010-05-02 14:23:38.654 INFO: modified One.txt
[ 3728] 2010-05-02 14:23:38.654 INFO: modified Two.txt
0.714 Using fetch logic to copy between CHKInventoryRepository('file:///C:/Program%20Files/Bazaar/devBranch/.bzr/repository/')(RepositoryFormat2a()) and CHKInventoryRepository('sftp://vieweng@')(RepositoryFormat2a())
0.714 fetch up to rev {dave@davepc-20100502062338-q78232akhc9to9ya}
0.754 Raising exception with args ('The file could not be opened because it is locked by another process.',)
0.775 Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 853, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1055, in run_bzr
  File "bzrlib\commands.pyo", line 661, in run_argv_aliases
  File "bzrlib\commands.pyo", line 665, in run_direct
  File "bzrlib\cleanup.pyo", line 122, in run_simple
  File "bzrlib\cleanup.pyo", line 156, in _do_with_cleanups
  File "bzrlib\builtins.pyo", line 3138, in run
  File "bzrlib\decorators.pyo", line 194, in write_locked
  File "bzrlib\workingtree_4.pyo", line 197, in commit
  File "bzrlib\decorators.pyo", line 194, in write_locked
  File "bzrlib\mutabletree.pyo", line 225, in commit
  File "bzrlib\commit.pyo", line 257, in commit
  File "bzrlib\cleanup.pyo", line 118, in run
  File "bzrlib\cleanup.pyo", line 156, in _do_with_cleanups
  File "bzrlib\commit.pyo", line 420, in _commit
  File "bzrlib\branch.pyo", line 923, in import_last_revision_info
  File "bzrlib\repository.pyo", line 1704, in fetch
  File "bzrlib\decorators.pyo", line 194, in write_locked
  File "bzrlib\repository.pyo", line 3438, in fetch
  File "bzrlib\fetch.pyo", line 83, in __init__
  File "bzrlib\fetch.pyo", line 109, in __fetch
  File "bzrlib\fetch.pyo", line 137, in _fetch_everything_for_search
  File "bzrlib\repository.pyo", line 4279, in insert_stream
  File "bzrlib\repository.pyo", line 4380, in _locked_insert_stream
  File "bzrlib\repository.pyo", line 1563, in commit_write_group
  File "bzrlib\repofmt\pack_repo.pyo", line 2314, in _commit_write_group
  File "bzrlib\repofmt\pack_repo.pyo", line 2148, in _commit_write_group
  File "bzrlib\repofmt\groupcompress_repo.pyo", line 633, in _check_new_inventories
  File "bzrlib\repofmt\groupcompress_repo.pyo", line 1179, in _build_interesting_key_sets
  File "bzrlib\repofmt\groupcompress_repo.pyo", line 896, in _iter_inventories
  File "bzrlib\groupcompress.pyo", line 1413, in get_record_stream
  File "bzrlib\groupcompress.pyo", line 1572, in _get_remaining_record_stream
  File "bzrlib\groupcompress.pyo", line 1130, in yield_factories
  File "bzrlib\groupcompress.pyo", line 1369, in _get_blocks
  File "bzrlib\knit.pyo", line 3370, in get_raw_records
  File "bzrlib\pack.pyo", line 221, in make_readv_reader
  File "bzrlib\transport\__init__.pyo", line 658, in readv
  File "bzrlib\transport\sftp.pyo", line 461, in _readv
  File "bzrlib\transport\sftp.pyo", line 721, in _translate_io_exception
IOError: The file could not be opened because it is locked by another process.

0.775 Transferred: 3KiB (8.3K/s r:3K w:0K)
0.775 return code 3

Martin Pool (mbp) wrote :

Thanks for the report and traceback. I see we're getting the error when we're trying to read, not write. The problem here may be that bzr has got separate ssh file handles open for reading and writing and something about this environment is making them conflict with each other?

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
tags: added: sftp win32
Martin Pool (mbp) wrote :

You could try running bzr+ssh under winsshd; that will probably avoid the problem.

Jelmer Vernooij (jelmer) on 2017-11-09
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers