"hg push" hangs for one minute (exactly one minute)

Ernie Rael err at raelity.com
Sat Apr 30 01:28:42 UTC 2022


On 4/28/22 12:46 PM, Anton Shestakov wrote:
> Looks like either another process is holding a lock on caches or the
> FS doesn't support locking mechanisms that sqlite3 needs.

A small python program at end of this post outlines a fix. It makes 
sqlite3's optional nolock vfs the default. Then evolve can use 
mercurial's locking mechanisms. It's tailored to my local python 
installation, and I've never used ctypes before, but it does work.

I'm still curious why no error is being generated in the current 
situation. Evolve is unable to update it's database. It's not that much, 
if any, of a stretch to say that the repo is corrupted, and nothing is 
reported.

For refence:
     https://www.sqlite.org/vfs.html
     https://www.sqlite.org/c3ref/vfs_find.html

======================================

#!/bin/python

from ctypes import *
import sqlite3

s3 = 
cdll.LoadLibrary("/usr/lib/python3.9/lib-dynload/_sqlite3.cpython-39-x86_64-linux-gnu.so")
s3_vfs_find = s3.sqlite3_vfs_find
s3_vfs_register = s3.sqlite3_vfs_register

s3_vfs_find.restype = c_void_p
s3_vfs_find.argtypes = [c_char_p]
vfs = s3_vfs_find(b"unix-none")
#print('vfs:', hex(vfs))

s3_vfs_register.restype = c_int
s3_vfs_register.argtypes = [c_void_p, c_int]
# make the nolock vfs the default
rc = s3_vfs_register(vfs, 1)
print('vfs register rc:', rc)

# Without changing the default vfs to "unix-none",
# the following times out from linux to NAS mounted with cifs.
# It leaves an empty /z/play/cache.db file.

connection = sqlite3.connect('/z/play/cache.db')
cur = connection.cursor()
cur.execute('''create table item
   (id integer primary key, itemno text unique)''')

connection.commit()
cur.close()





More information about the Mercurial mailing list