Skip to content

Commit

Permalink
Increases anti-lock timeout to avoid 'Locked !?!?' file-lock errors (…
Browse files Browse the repository at this point in the history
…see #90) (#112)

* Armadietto is prone to 'Locked !?!?' file-lock errors in real world situations:  the timeout of 200ms is insufficient when batch putting or getting.

Provide file lock timeout flexibility and make gets non-locking:  just cross-checking etag before and after.

* Skip node 12.

* Add hosted load test link.

* Sets default lock timeout to 30 seconds

---------

Co-authored-by: Jakub Ner <[email protected]>
  • Loading branch information
DougReeder and Jakub Ner authored Feb 21, 2024
1 parent cbe4c5b commit a9490c3
Show file tree
Hide file tree
Showing 11 changed files with 477 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
# Support LTS versions based on https://nodejs.org/en/about/releases/
node-version: ['12', '14', '16']
node-version: ['18', '20', '21']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ jobs:
run: npm run lint
- name: Run tests
run: npm test

11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@ const server = new Armadietto({
server.boot();
```

## Lock file contention

The data-access locking mechanism is lock-file based.

You may need to tune the lock-file timeouts in your configuration:

- *lock_timeout_ms* - millis to wait for lock file to be available
- *lock_stale_after_ms* - millis to wait to deem lockfile stale

To tune run the [hosted RS load test](https://overhide.github.io/armadietto/example/load.html) or follow instructions in [example/README.md](example/README.md) for local setup and subsequently run [example/load.html](example/load.html) off of `npm run serve` therein.

## Debugging an installation

Set the environment `DEBUG` to enable logging. For example `DEBUG=true armadietto -c /etc/armadietto/conf.json`
Expand Down
2 changes: 1 addition & 1 deletion bin/armadietto.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const remoteStorageServer = {
}

process.umask(0o077);
const store = new Armadietto.FileTree({ path: conf.storage_path });
const store = new Armadietto.FileTree({ path: conf.storage_path, lock_timeout_ms: conf.lock_timeout_ms, lock_stale_after_ms: conf.lock_stale_after_ms });
const server = new Armadietto({
basePath: conf.basePath,
store,
Expand Down
2 changes: 2 additions & 0 deletions bin/dev-conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"basePath": "",
"allow_signup": true,
"storage_path": "./dev-storage",
"lock_timeout_ms": 30000,
"lock_stale_after_ms": 60000,
"cache_views": true,
"http": {
"host": "127.0.0.1",
Expand Down
2 changes: 1 addition & 1 deletion contrib/openwrt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See [TLS certificates for a server](https://openwrt.org/docs/guide-user/services
We assume that you already issued a cert

To store data you need to mount a disk.
See [Quick Start for Adding a USB drive](https://openwrt.org/docs/guide-user/storage/usb-drives-quickstart).
See [Quick Start for Adding a USB drive](https://openwrt.org/docs/guide-user/storage/usb-drives-quickstart).

In the example it's mounted to /mnt/disk/
Next we need to create a folder to store the user data. Login to OpenWrt with `ssh [email protected]` and execute:
Expand Down
4 changes: 2 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>RemoteStorage Demo</title>
<script type="text/javascript" src="../node_modules/remotestoragejs/release/remotestorage.js"></script>
<script src="../node_modules/remotestorage-widget/build/widget.js"></script>
<script src="https://cdn.jsdelivr.net/npm/remotestoragejs@latest/release/remotestorage.js"></script>
<script src="https://cdn.jsdelivr.net/npm/remotestorage-widget@latest/build/widget.js"></script>

<!-- ignore below :: code pane / logging pane setup -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <!-- only needed for logging and code panes -->
Expand Down
Loading

0 comments on commit a9490c3

Please sign in to comment.