Skip to content

Commit

Permalink
doc: add profiling build instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanCacqueray committed Jan 3, 2024
1 parent 9a60ca4 commit 2ba9fdd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,22 @@ Get crawler errors:
```ShellSession
curl -X POST -d '{"index": "monocle"}' -H "Content-type: application/json" localhost:8080/api/2/crawler/errors
```

## Debug by dumping every stacktrace

When the service fails with an obscure `NonEmpty.fromList: empty list`, run the following commands to get the full stacktrace:

```ShellSession
cabal --ghc-options="-fprof-auto" --enable-executable-profiling --enable-profiling --enable-library-profiling -O0 run exe:monocle -- api +RTS -xc -RTS
```

Note that this also shows legitimate exceptions that are correctly caught, but hopefully you should see something like:

```
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
GHC.IsList.CAF
--> evaluated by: Monocle.Backend.Index.getChangesByURL,
called from Monocle.Backend.Index.taskDataAdd,
called ...
NonEmpty.fromList: empty list
```

0 comments on commit 2ba9fdd

Please sign in to comment.