[ 
https://issues.apache.org/jira/browse/KAFKA-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14999299#comment-14999299
 ] 

ASF GitHub Bot commented on KAFKA-2795:
---------------------------------------

GitHub user hachikuji opened a pull request:

    https://github.com/apache/kafka/pull/488

    KAFKA-2795: fix potential NPE in GroupMetadataManager.addGroup

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/hachikuji/kafka KAFKA-2795

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/488.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #488
    
----
commit 095456ccee67cb97913158c2b78a92ad90970745
Author: Jason Gustafson <ja...@confluent.io>
Date:   2015-11-10T20:31:53Z

    KAFKA-2795: fix potential NPE in addGroup

----


> potential NPE in GroupMetadataManager
> -------------------------------------
>
>                 Key: KAFKA-2795
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2795
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Onur Karaman
>            Assignee: Jason Gustafson
>
> I didn't run the code, but I took a look at GroupMetadataManager.addGroup and 
> it looks like we can get a NullPointerException when a group is somehow 
> removed between the groupsCache.putIfNotExists and groupsCache.get lines and 
> someone tries to use the result of the addGroup. One way this can happen is 
> by interleaving GroupMetadataManager.addGroup and 
> GroupMetadataManager.removeGroupsForPartition.
> Here's the scenario:
> # thread-1 is in the middle of adding a group g which is in the offset topic 
> partition p. thread-1 already hit the groupsCache.putIfNotExists line in 
> GroupMetadataManager.addGroup
> # thread-2 is in the middle of migrating all groups for partition p. thread-2 
> is in GroupMetadataManager.removeGroupsForPartition and called 
> groupsCache.remove("g").
> # thread-1 now executes groupsCache.get("g"), which returns null since it's 
> now gone.
> # thread-1 now goes back to the GroupCoordinator doJoinGroup with a null 
> GroupMetadata and then tries to do a group synchronized {...}, resulting in 
> an NPE.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to