I’m working on application which should react to ledger changes and updated ledger depending on current ledger state and application settings. We took GitHub - digital-asset/ex-java-bindings: Three examples demonstrating three different approaches to using the Java ledger API bindings sample sources to start with. Right now I’m getting deadlock when trying to get active contracts within new transaction handler.
I’ve created fork of ex-java-bindings sample to reproduce this behavior - GitHub - alekseilarionovepam/ex-java-bindings: Three examples demonstrating three different approaches to using the Java ledger API bindings . There are just 2 changes:
- Increased application timeout to 1 minute
- Added getActiveContracts call to processEvent method
If run this sample you’ll see few lines of logs (5-7 lines) and that program is stuck. Not like with original sample - more that 100 lines of logs. There will be deadlock at blockingGet call:
client.getActiveContractSetClient() .getActiveContracts(new FiltersByParty(Collections.singletonMap(party, NoFilter.instance)), true) .toList() .blockingGet();
I guess it happens because DamlLedgerClient uses SingleThreadExecutionSequencerPool for processing request and we are trying to wait for new request’s result from within previous request’s result processing. Or something very similar
I can work around this issue with processing new transactions in a separate thread. Code can be found on workaround branch.
Is this expected behavior or a bug?