You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/12/19 18:50:00 UTC

[jira] [Commented] (KAFKA-6383) StreamThread.shutdown doesn't clean up completely when called before StreamThread.start

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

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

GitHub user rodesai opened a pull request:

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

    KAFKA-6383: complete shutdown for CREATED StreamThreads

    When transitioning StreamThread from CREATED to PENDING_SHUTDOWN
    free up resources from the caller, rather than the stream thread,
    since in this case the stream thread was never actually started.
    
    In KakfaStreams.close, shut down the streams threads from the
    close thread. StreamThread.shutdown may now block, so call this
    from the close thread so that the timeout is honored.
    
    *More detailed description of your change,
    if necessary. The PR title and PR message become
    the squashed commit message, so use a separate
    comment to ping reviewers.*
    
    *Summary of testing strategy (including rationale)
    for the feature or bug fix. Unit and/or integration
    tests are expected for any behaviour change and
    system tests should be considered for larger changes.*
    
    ### Committer Checklist (excluded from commit message)
    - [ ] Verify design and implementation 
    - [ ] Verify test coverage and CI build status
    - [ ] Verify documentation (including upgrade notes)


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

    $ git pull https://github.com/rodesai/kafka KAFKA-6383

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

    https://github.com/apache/kafka/pull/4343.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 #4343
    
----
commit ab98a90027189dc12e3df99caf3d4f2aab8fefa0
Author: Rohan Desai <de...@gmail.com>
Date:   2017-12-19T18:14:20Z

    KAFKA-6383: complete shutdown for CREATED StreamThreads
    
    When transitioning StreamThread from CREATED to PENDING_SHUTDOWN
    free up resources from the caller, rather than the stream thread,
    since in this case the stream thread was never actually started.
    
    In KakfaStreams.close, shut down the streams threads from the
    close thread. StreamThread.shutdown may now block, so call this
    from the close thread so that the timeout is honored.

----


> StreamThread.shutdown doesn't clean up completely when called before StreamThread.start
> ---------------------------------------------------------------------------------------
>
>                 Key: KAFKA-6383
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6383
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions: 1.0.0
>            Reporter: Rohan Desai
>
> The following code leaks a producer network thread:
> {code}
> ks = new KafkaStreams(...);
> ks.close();
> {code}
> The underlying issue is that KafkaStreams creates a bunch of StreamsThreads via StreamThread.create, which in turn creates a bunch of stuff (including a producer). These resources are cleaned up only when the thread exits. So if the thread was never started, then they are never cleaned up. StreamThread.shutdown should clean up if it sees that the thread has never been started.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)