mirror of
https://github.com/laurent22/joplin.git
synced 2026-06-18 20:16:34 +02:00
Docs: Add information about the sync fuzzer to the "Debugging the server project" page (#14404)
This commit is contained in:
@@ -53,3 +53,26 @@ When running in development mode, several debug commands can be run by sending r
|
||||
- The `benchmarkDeltaPerformance` command tests the performance of `models.change().delta` by calling `delta` multiple times for each user account. Data is saved in `packages/server/delta-perf.csv`.
|
||||
- `ChangeModel.delta` is called during sync and has historically been a performance bottleneck.
|
||||
- Example: `curl --data '{"action":"benchmarkDeltaPerformance"}' -H 'Content-Type: application/json' http://localhost:22300/api/debug`.
|
||||
|
||||
## Fuzzing
|
||||
|
||||
The sync fuzzer looks for sync bugs. It works by:
|
||||
|
||||
- Starting an instance of Joplin Server in development mode.
|
||||
- Starting instances of the CLI app and connecting them to the server.
|
||||
- Performing pseudorandom actions (e.g. "create note", "delete note", "sync").
|
||||
|
||||
The fuzzer maintains a model of the expected state of the CLI apps. When the actual state of the CLI apps no longer matches this model, the fuzzer stops.
|
||||
|
||||
To start the fuzzer, run `yarn syncFuzzer start` from the main Joplin workspace directory. See `yarn syncFuzzer start --help` for more information.
|
||||
|
||||
**Note**: If you encounter an "unauthorized" error, it may be necessary to set the `FUZZER_SERVER_ADMIN_PASSWORD` environment variable before running the fuzzer.
|
||||
|
||||
### Fuzzing with breakpoints
|
||||
|
||||
To pause the fuzzer at breakpoints in the client/server logic, use a "JavaScript Debug Terminal" in VS Code:
|
||||
|
||||
1. Open a debug terminal in VS Code (command palette > "Debug: JavaScript Debug Terminal").
|
||||
2. Start the sync fuzzer (`yarn syncFuzzer start`).
|
||||
|
||||
When debugging, the `--setup=<path to setup file>`, `--snapshot-after=<steps>` and `--restore-from-snapshot` options can be particularly helpful (see `yarn syncFuzzer start --help`).
|
||||
|
||||
Reference in New Issue
Block a user