hyperledger / fabric-gateway

Go, Node and Java client API for Hyperledger Fabric v2.4+
https://hyperledger.github.io/fabric-gateway/
Apache License 2.0
152 stars 89 forks source link

Intermittent failure in Java eventing unit tests #696

Closed bestbeforetoday closed 3 weeks ago

bestbeforetoday commented 6 months ago

Errors similar to this periodically occur in the automated build:

java.util.NoSuchElementException: No value present
    at java.base/java.util.Optional.get(Optional.java:143)
    at org.hyperledger.fabric.client.CommonBlockEventsTest.uses_checkpoint_block_zero_with_set_transaction_id_instead_of_specified_start_block(CommonBlockEventsTest.java:263)

I suspect this is caused by a concurrency issue in the capture of events by the Mockito mocks. It might be necessary to use explicit synchronization to ensure values are visible to the calling thread.

bestbeforetoday commented 6 months ago

Intermittent failures are still occurring, such as:

java.util.NoSuchElementException: No value present
    at java.base/java.util.Optional.get(Optional.java:143)
    at org.hyperledger.fabric.client.CommonBlockEventsTest.sends_valid_request_with_specified_start_block_number(CommonBlockEventsTest.java:155)

and

java.util.NoSuchElementException: No value present
    at java.base/java.util.Optional.get(Optional.java:143)
    at org.hyperledger.fabric.client.CommonBlockEventsTest.sends_valid_request_with_specified_start_block_number_using_sign_bit_for_unsigned_64bit_value(CommonBlockEventsTest.java:175)