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

[BEAM-14405] Fix NPE when ProjectID is not specified in a template execution #17540

Merged
merged 1 commit into from
May 4, 2022

Conversation

nielm
Copy link
Contributor

@nielm nielm commented May 4, 2022

PR #16547 added handling for null ProjectIDs on command line execution,
but did not handle the possibility of null ProjectIDs in template
execution. PR #17094 added nullness checks in MonitoringInfoMetricNames,
which then triggered NPEs if the ProjectID was not specified during a
template execution.

This corrects this by checking for a null ValueProvider, a null value in the ValueProvider, and an empty String in the ValueProvider.


GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@asf-ci
Copy link

asf-ci commented May 4, 2022

Can one of the admins verify this patch?

1 similar comment
@asf-ci
Copy link

asf-ci commented May 4, 2022

Can one of the admins verify this patch?

@nielm
Copy link
Contributor Author

nielm commented May 4, 2022

R: @lukecwik

@nielm
Copy link
Contributor Author

nielm commented May 4, 2022

Run Java PreCommit

Copy link
Contributor

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

Thanks. LGTM.

…ecution

PR apache#16547 added handling for null ProjectIDs on command line execution,
but did not handle the possibility of null ProjectIDs in template
execution. PR apache#17094 added nullness checks in MonitoringInfoMetricNames,
which then triggered NPEs if the ProjectID was not specified during a
template execution.
@nielm
Copy link
Contributor Author

nielm commented May 4, 2022

One minor update - added an .isEmpty() check for the projectID value (as well as nullness).

@nielm
Copy link
Contributor Author

nielm commented May 4, 2022

Run Java PreCommit

@chamikaramj chamikaramj merged commit 43d488c into apache:master May 4, 2022
@nielm nielm deleted the BEAM-14405 branch May 4, 2022 15:32
@kennknowles
Copy link
Member

Would be great to follow up by removing the suppressions that made NPE possible in the first place, or we should presume there are others lurking.

@nielm
Copy link
Contributor Author

nielm commented May 4, 2022

I am not sure what you mean by 'supressions' here?
(This issue is unrelated to the suppression of runtime exceptions in Spanner, GCS, DataStore connectors)

The NPE was introduced in 2.35 (along with the other issue) by the implementor of the MontoringInfoMetrics, who assumed that the projectId could never be null.

I fixed this in 2.37, but assumed naively/incorrectly that the projectID valueProvider object would always be null when a value was not present - which is normally true for command line executions but not for template executions (nor when a user explicitly passes a null value).

This was not noticed until an unrelated change used an ImmutableMap for MontoringInfoMetricName keys, which enforced non-null values (in 2.38).

So yes it is still possible that there are various NPEs waiting to be found in other IOs where MonitoringInfoMetrics were added.

@kennknowles
Copy link
Member

@SuppressWarnings("nullness") is what I mean by suppressions.

@kennknowles
Copy link
Member

We use checkerframework, which is a full type system (not heuristic) that prevents NPEs wherever it is not disabled.

@aaltay
Copy link
Member

aaltay commented May 11, 2022

Should this be mentioned in the release notes for 2.38.0 as a known issue?

@chamikaramj
Copy link
Contributor

Currently Beam release notes seems to be a list of auto generated JIRAs created at release time. For example, https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12319527&version=12351169

Is there a better place to record known issues found after that fact ?

@kennknowles
Copy link
Member

There's CHANGES.md and the blog post and the affected versions field in the Jira. I don't know if we point users to these very much.

@chamikaramj
Copy link
Contributor

CHANGES.md seems to be the best candidate. Sent #17631 to update it on this and other recent issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants