input-output-hk / plutus-apps

The Plutus application platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues running Chain-index on WSL2 - fully syncing but not running the webserver

RustyCamel opened this issue · comments


I've run into an issue with the chain-index while trying to run a PAB testnet environment on Ubuntu (WSL2). The index will start up, sync to 100%, update to new blocks, but the webserver will never start. In fact, the port that the chain-index is supposed to occupy remains empty throughout this process. Commmands like curl -s localhost:9083/tip | jq '.tipSlot.getSlot' return nothing.

After some debugging, I isolated this piece of code - this is the last piece of code that runs after starting the chain-index server:

withAsync (runLogEffects (convertLog PrettyObject trace) $ logProgress chan) wait

It seems to log the output of the chain-index's progress, but I'm not sure. I believe it's responsible for outputs like this on the console:

[chain-index:Info:39] [2022-03-06 10:13:17.47 UTC] Still in sync. Applied 13 blocks, 0 rollbacks in the last 300s. Current tip is Point(Slot 52192355, BlockId 1893367e3a8139b6866e4c6e81bb1d2ecfa80660b1b027785f05d3e309a2d6d6)

This is the source of the problematic line: plutus-apps/plutus-chain-index/src/Plutus/ChainIndex/App.hs

I have two theories, but otherwise don't really know where to go from here.

  1. There are some issues with running an Async function in WSL2 (unlikely as I see Async functions in other, working Plutus apps)
  2. The database is corrupted somehow, and the line of code shown above is parsing through it in an attempt to fix it. I've tried rebuilding the database three times (using different commits on Github) to no avail.

Steps to reproduce the behavior

  1. Setup Ubuntu using (WSL2)
  2. Setup plutus-apps and nix-shell environment
  3. Setup testnet node and chain index following the procedure in plutus-apps/plutus-pab/test-node/
  4. Start testnet node plutus-apps/plutus-pab/test-node/
  5. Start chain index cabal exec -- plutus-chain-index --config testnet/chain-index-config.json start-index

Actual Result

  • Node starts, and syncs as expected.
  • Chain-index starts, and syncs with messages like this [chain-index:Info:39] [2022-03-08 22:43:10.55 UTC] Syncing (17.81%). Applied 5639 blocks, 1 rollbacks in the last 30s. Current tip is Point(Slot 217317, BlockId 30a184e831362e7f6674ab5a6a94607e2222d440efab77eb5aedad9be5470328)
  • Occasional error: ChainIndexError: Insertion failed: UTxO insertion failed - already a block with the given number
  • Chain-index webserver never starts, and the port 9083 remains unoccupied throughout the process and even after sync completion

Expected Result

Chain-index webserver starts on port 9083.

Describe the approach you would take to fix this

No response

System info

OS: Ubuntu (WSL2)
Version: 20.04.4 LTS (Focal Fossa)
Plutus: Various tags and commits, including v2022-01-17 and the latest commit

Thanks for reporting! Indeed there is a problem with withAsync handler. Will be fixed in #351.

ezoic increase your site revenue