Skip to content

[HOT FIX] Check for null before deserializing in MeteredSessionStore #6575

Merged
bbejeck merged 3 commits intoapache:trunkfrom
ableegoldman:MeteredSessionStoreCleanup
Apr 17, 2019
Merged

[HOT FIX] Check for null before deserializing in MeteredSessionStore #6575
bbejeck merged 3 commits intoapache:trunkfrom
ableegoldman:MeteredSessionStoreCleanup

Conversation

@ableegoldman
Copy link
Copy Markdown
Member

The fetchSession() method of SessionStore searches for a (single) specific session and returns null if none are found. This is analogous to fetch(key, time) in WindowStore or get(key) in KeyValueStore. MeteredWindowStore and MeteredKeyValueStore both check for a null result before attempting to deserialize, however MeteredSessionStore just blindly deserializes and as a result NPE is thrown when we search for a record that does not exist.

Also piggyback on this: fetch() in the Metered layer currently delegates to findSessions with time range [0, Long.MAX_VALUE]. It should instead call the wrapped store's fetch directly (which may then delegate to findSessions or not)

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@ableegoldman
Copy link
Copy Markdown
Member Author

@bbejeck
Copy link
Copy Markdown
Member

bbejeck commented Apr 12, 2019

@ableegoldman failure is related Execution failed for task ':streams:spotbugsMain'

@ableegoldman
Copy link
Copy Markdown
Member Author

Whoops, thanks spotBugs

@bbejeck
Copy link
Copy Markdown
Member

bbejeck commented Apr 13, 2019

@ableegoldman failures seem related

@bbejeck
Copy link
Copy Markdown
Member

bbejeck commented Apr 16, 2019

Java 8 passed Java 11 failed with known flaky test kafka.api.ConsumerBounceTest.testRollingBrokerRestartsWithSmallerMaxGroupSizeConfigDisruptsBigGroup

retest this please

@bbejeck
Copy link
Copy Markdown
Member

bbejeck commented Apr 16, 2019

Java 8 failed with known flaky test kafka.api.ConsumerBounceTest.testRollingBrokerRestartsWithSmallerMaxGroupSizeConfigDisruptsBigGroup Java 11 passed

retest this please

@bbejeck
Copy link
Copy Markdown
Member

bbejeck commented Apr 17, 2019

Both Java 8 and Java 11 failed; test results already cleaned up.

retest this please

@bbejeck bbejeck merged commit c783630 into apache:trunk Apr 17, 2019
@bbejeck
Copy link
Copy Markdown
Member

bbejeck commented Apr 17, 2019

Merged #6575 into trunk

pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
…pache#6575)

The fetchSession() method of SessionStore searches for a (single) specific session and returns null if none are found. This is analogous to fetch(key, time) in WindowStore or get(key) in KeyValueStore. MeteredWindowStore and MeteredKeyValueStore both check for a null result before attempting to deserialize, however MeteredSessionStore just blindly deserializes and as a result NPE is thrown when we search for a record that does not exist.

Reviewers: Guozhang Wang <wangguoz@gmail.com>, Bill Bejeck <bbejeck@gmail.com>, Bruno Cadonna <bruno@confluent.io>
@ableegoldman ableegoldman deleted the MeteredSessionStoreCleanup branch June 26, 2020 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants