joinmarket-clientserver icon indicating copy to clipboard operation
joinmarket-clientserver copied to clipboard

yg-privacyenhanced.py: handling wallet .lock file

Open github12101 opened this issue 5 years ago • 5 comments

Wallet file lock issue: When yg-privacyenhanced.py has been closed uncleanly, upon next start, we have error:

python yg-privacyenhanced.py wallet.jmdat
User data location: /home/nv01/.joinmarket/
Enter wallet decryption passphrase: 
Failed to load wallet, error message: RetryableStorageError('File is currently in use (locked by pid 13327). If this is a leftover from a crashed instance you need to remove the lock file `/home/nv01/.joinmarket/wallets/wallet.jmdat.lock` manually.')
Traceback (most recent call last):
  File "yg-privacyenhanced.py", line 98, in <module>
    minsize=minsize, gaplimit=gaplimit)
  File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/yieldgenerator.py", line 249, in ygmain
    gap_limit=options.gaplimit)
  File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_utils.py", line 1126, in open_test_wallet_maybe
    return open_wallet(path, mixdepth=max_mixdepth, **kwargs)
  File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_utils.py", line 1166, in open_wallet
    raise e
  File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_utils.py", line 1159, in open_wallet
    storage = Storage(path, password=pwd, read_only=read_only)
  File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 109, in __init__
    self._create_lock()
  File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 297, in _create_lock
    format(locked_by_pid, lock_filename))
jmclient.storage.RetryableStorageError: File is currently in use (locked by pid 13327). If this is a leftover from a crashed instance you need to remove the lock file `/home/nv01/.joinmarket/wallets/wallet.jmdat.lock` manually.

Enhancement request:

  1. yg-privacyenhanced.py should detect .lock file BEFORE asking for password, why type it and verify it when it's going to fall back to console due to lock file present anyway

  2. yg-privacyenhanced.py should handle this issue, detect on it's own that it's not running and delete the lock

github12101 avatar Feb 10 '20 13:02 github12101

wrt your suggestions:

1: that sounds very logical, also it could be a good first issue for someone to write a PR for as it's quite simple.

2: that's a lot more debatable, I'd say not: there is more than one kind of long running script (the other one is tumbler.py, and there is also the GUI offering the same function), so for now I'd be inclined not to bother with logic to avoid the need for manual intervention (although I agree it's technically feasible).

AdamISZ avatar Feb 10 '20 15:02 AdamISZ

I agree with @AdamISZ here (doing 1 and not doing 2).

kristapsk avatar Feb 10 '20 15:02 kristapsk

Not directly related with this issue, but probably we should re-label Beginner-friendly issues as "good first issue", as this is what Github now promotes for all repos... What do others think? @AdamISZ ? @chris-belcher ?

image

kristapsk avatar Feb 14 '20 23:02 kristapsk

Great idea, thanks.

AdamISZ avatar Feb 15 '20 00:02 AdamISZ

Not directly related with this issue, but probably we should re-label Beginner-friendly issues as "good first issue", as this is what Github now promotes for all repos... What do others think? @AdamISZ ? @chris-belcher ?

done

AdamISZ avatar Jun 02 '22 16:06 AdamISZ

(1) is resolved now, do we have consensus to not do (2)?

kristapsk avatar Aug 03 '23 09:08 kristapsk

+1 on not doing point 2

roshii avatar Aug 03 '23 09:08 roshii