Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Clean up manager creation to avoid NPEs during background start #1586

Merged
merged 4 commits into from
Sep 23, 2024

Conversation

SamMayWork
Copy link
Contributor

@SamMayWork SamMayWork commented Sep 19, 2024

ref: #1585 (comment)

Without this fix when calling to create a contract manager, it's possible for both the return value and the error value to be non-nil. This ensures that strictly one or the other is set.

or.contracts, err = contracts.NewContractManager(ctx, or.namespace.Name, or.database(), or.blockchain(), or.data, or.broadcast, or.messaging, or.batch, or.identity, or.operations, or.txHelper, or.txWriter, or.syncasync, or.cacheManager)

Need to test using the steps provided above to ensure the fix is good (also pending UT coverage).

Signed-off-by: SamMayWork <sam.may@kaleido.io>
@SamMayWork SamMayWork requested a review from a team as a code owner September 19, 2024 17:19
@SamMayWork SamMayWork changed the title fix: check error before return fix: Check errors from listener verification before returning Contract Manager Sep 19, 2024
@SamMayWork SamMayWork changed the title fix: Check errors from listener verification before returning Contract Manager fix: Check errors from listener verification before returning from Contract Manager Sep 19, 2024
Signed-off-by: SamMayWork <sam.may@kaleido.io>
@EnriqueL8
Copy link
Contributor

Gonna have to fix the Docker image

1.121 fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz
1.444 ERROR: unable to select packages:
1.446   postgresql16-client-16.4-r0:
1.446     breaks: world[postgresql16-client=16.3-r0]

@SamMayWork
Copy link
Contributor Author

Fix tested manually using the recreate from #1585 (comment) and all looks good.

@SamMayWork SamMayWork changed the title fix: Check errors from listener verification before returning from Contract Manager fix: Clean up manager creation to avoid NPEs during background start Sep 23, 2024
Signed-off-by: SamMayWork <sam.may@kaleido.io>
Signed-off-by: SamMayWork <sam.may@kaleido.io>
Copy link

codecov bot commented Sep 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (dc97c73) to head (4822087).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1586   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          337       337           
  Lines        24225     24230    +5     
=========================================
+ Hits         24225     24230    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -75,7 +75,7 @@ ARG UI_TAG
ARG UI_RELEASE
RUN apk add --update --no-cache \
sqlite=3.44.2-r0 \
postgresql16-client=16.3-r0 \
postgresql16-client=16.4-r0 \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required to get the build working, looks like the old version of the client has been removed. A quick look through the PostgreSQL release notes for this version suggests it just contains bug fixes: https://www.postgresql.org/docs/release/16.4/

The extent of testing done on the new client version is the UTs in this repo, if there's any further testing required let me know.

Copy link
Contributor

@peterbroadhurst peterbroadhurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great investigation and fix 👍

@peterbroadhurst peterbroadhurst merged commit c9bed10 into hyperledger:main Sep 23, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants