Skip to content

fix: fix lock for node 11 #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 19, 2018
Merged

fix: fix lock for node 11 #181

merged 3 commits into from
Nov 19, 2018

Conversation

hugomrdias
Copy link
Member

This PR swaps lock-me for proper-lockfile which fixes compat with node 11 and also brings others improvements https://github.com/moxystudio/node-proper-lockfile.

  • better support for network file systems
  • staleness support
  • better clean up for process shutdown

ref: ipfs/js-ipfs#1700

@ghost ghost assigned hugomrdias Nov 19, 2018
@ghost ghost added the status/in-progress In progress label Nov 19, 2018
@jacobheun
Copy link
Contributor

@hugomrdias it looks like we're not testing the .locked method on locks. Can you update the lock tests to include a test for that so we can make sure there aren't issues there?

@hugomrdias
Copy link
Member Author

we aren't actually using it :)

js-ipfs-repo/src/index.js

Lines 197 to 204 in e028a9e

*/
_isLocked (path, callback) {
if (this._locker) {
return this._locker.locked(path, callback)
}
callback(null, false)
}

Do you want me to add a test to this private method ?

@jacobheun
Copy link
Contributor

We should just remove _isLocked and the locker.locked functions then. No sense in having private code we're not using.

@hugomrdias
Copy link
Member Author

done

@jacobheun
Copy link
Contributor

Linting needs fixed, otherwise this looks good.

@jacobheun jacobheun merged commit bec2a5d into master Nov 19, 2018
@ghost ghost removed the status/in-progress In progress label Nov 19, 2018
@jacobheun jacobheun deleted the fix/lock-node-11 branch November 19, 2018 17:51
@alanshaw
Copy link
Member

@hugomrdias @jacobheun would you mind looking into this failure:

  1) interface-ipfs-core over ipfs-api tests
       .key.rename
         "after all" hook:
     Error: Lock is already released
      at callback (node_modules/proper-lockfile/lib/lockfile.js:222:60)
      at Promise (node_modules/proper-lockfile/lib/adapter.js:39:9)
      at new Promise (<anonymous>)
      at args (node_modules/proper-lockfile/lib/adapter.js:30:25)
      at Object.close (node_modules/ipfs-repo/src/lock.js:25:9)
      at IpfsRepo._closeLock (node_modules/ipfs-repo/src/index.js:186:28)
      at series (node_modules/ipfs-repo/src/index.js:243:14)
      at /tmp/jenkins/workspace/IPFS_js-ipfs_PR-1720-BOTRBRZAZU5M646NTADACC3XMRHJPUFDKJYCZI4VMLV72YC6IHHA@2/node_modules/async/internal/parallel.js:31:39
      at replenish (node_modules/async/internal/eachOfLimit.js:66:17)
      at iterateeCallback (node_modules/async/internal/eachOfLimit.js:50:17)
      at /tmp/jenkins/workspace/IPFS_js-ipfs_PR-1720-BOTRBRZAZU5M646NTADACC3XMRHJPUFDKJYCZI4VMLV72YC6IHHA@2/node_modules/async/internal/onlyOnce.js:12:16
      at /tmp/jenkins/workspace/IPFS_js-ipfs_PR-1720-BOTRBRZAZU5M646NTADACC3XMRHJPUFDKJYCZI4VMLV72YC6IHHA@2/node_modules/async/internal/parallel.js:36:13
      at /tmp/jenkins/workspace/IPFS_js-ipfs_PR-1720-BOTRBRZAZU5M646NTADACC3XMRHJPUFDKJYCZI4VMLV72YC6IHHA@2/node_modules/async/internal/once.js:12:16
      at iteratorCallback (node_modules/async/eachOf.js:60:13)
      at /tmp/jenkins/workspace/IPFS_js-ipfs_PR-1720-BOTRBRZAZU5M646NTADACC3XMRHJPUFDKJYCZI4VMLV72YC6IHHA@2/node_modules/async/internal/onlyOnce.js:12:16
      at /tmp/jenkins/workspace/IPFS_js-ipfs_PR-1720-BOTRBRZAZU5M646NTADACC3XMRHJPUFDKJYCZI4VMLV72YC6IHHA@2/node_modules/levelup/lib/levelup.js:114:16
      at /tmp/jenkins/workspace/IPFS_js-ipfs_PR-1720-BOTRBRZAZU5M646NTADACC3XMRHJPUFDKJYCZI4VMLV72YC6IHHA@2/node_modules/abstract-leveldown/abstract-leveldown.js:67:5
      at /tmp/jenkins/workspace/IPFS_js-ipfs_PR-1720-BOTRBRZAZU5M646NTADACC3XMRHJPUFDKJYCZI4VMLV72YC6IHHA@2/node_modules/leveldown/node_modules/abstract-leveldown/abstract-leveldown.js:67:5

@hugomrdias
Copy link
Member Author

On it

alanshaw pushed a commit to ipfs/js-ipfs that referenced this pull request Nov 20, 2018
@Vishal1010101
Copy link

Vishal1010101 commented Feb 16, 2019

apple$ orbitdb create hello feed Error: Lock FcntlFlock of /Users/apple/orbitdb/ipfs/repo.lock failed: EINVAL, Invalid argument
Can anyone help? @hugomrdias @jacobheun

@jacobheun
Copy link
Contributor

@Vishal1010101 see ipfs/js-ipfs#1700 (comment). If you still encounter an issue, please open a new issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants