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 7422 - NullPointerException race on Urn property in C# SDK #8495

Merged
merged 4 commits into from
Dec 10, 2021

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Nov 24, 2021

Description

Under certain conditions, C# SDK can race to observe nulls in Urn property of a resource. This is reproduced via a non-deterministic mock test, and fixed in this PR.

Fixes #7422

On top of #8577 (requires merging that first).

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@gitfool
Copy link
Contributor

gitfool commented Nov 24, 2021

I can confirm that this resource was not initialized before adding to the parent:

image

This seems to fix that at least:

image

@t0yv0 t0yv0 changed the title WIP: initialize earlier Fix 7422 - NullPointerException race on Urn property in C# SDK Dec 9, 2021
@t0yv0 t0yv0 requested a review from a team December 9, 2021 22:44
@codecov
Copy link

codecov bot commented Dec 9, 2021

Codecov Report

Merging #8495 (2b5520b) into master (a318b4b) will increase coverage by 0.04%.
The diff coverage is 90.00%.

❗ Current head 2b5520b differs from pull request most recent head 2985174. Consider uploading reports for the commit 2985174 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8495      +/-   ##
==========================================
+ Coverage   58.70%   58.74%   +0.04%     
==========================================
  Files         634      634              
  Lines       96948    96950       +2     
  Branches     1378     1378              
==========================================
+ Hits        56910    56953      +43     
+ Misses      36776    36730      -46     
- Partials     3262     3267       +5     
Impacted Files Coverage Δ
sdk/dotnet/Pulumi/Stack.cs 81.81% <50.00%> (-9.26%) ⬇️
...mi/Deployment/Deployment_ReadOrRegisterResource.cs 78.57% <100.00%> (-0.31%) ⬇️
sdk/dotnet/Pulumi/Exceptions/RunException.cs 70.00% <100.00%> (+20.00%) ⬆️
sdk/dotnet/Pulumi/Resources/Resource.cs 48.91% <100.00%> (+11.55%) ⬆️
...net/Pulumi/Serialization/OutputCompletionSource.cs 97.77% <100.00%> (+8.88%) ⬆️
sdk/go/common/util/httputil/http.go 71.69% <0.00%> (-5.67%) ⬇️
pkg/cmd/pulumi/policy_new.go 40.36% <0.00%> (-1.38%) ⬇️
sdk/go/common/resource/properties.go 82.59% <0.00%> (-1.11%) ⬇️
pkg/codegen/docs/gen_kubernetes.go 7.33% <0.00%> (+0.13%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2348fa1...2985174. Read the comment docs.

@t0yv0 t0yv0 merged commit 06cefac into master Dec 10, 2021
@pulumi-bot pulumi-bot deleted the t0yv0/fix-nil-urn branch December 10, 2021 16:22
abhinav pushed a commit to pulumi/pulumi-dotnet that referenced this pull request Jan 11, 2023
…i/pulumi#8495)

* Prevent observable null Urn outputs

* Tests

* Formatting

* CHANGELOG
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.

[sdk/dotnet] Possible race condition results in NullReferenceException
3 participants