Bug 163204 - NetworkSession: NetworkDataTask is leaked if download finishes in didReceiveResponse completion handler
Summary: NetworkSession: NetworkDataTask is leaked if download finishes in didReceiveR...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-10 03:58 PDT by Carlos Garcia Campos
Modified: 2016-10-10 22:31 PDT (History)
2 users (show)

See Also:


Attachments
Patch (3.85 KB, patch)
2016-10-10 04:03 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Try to fix mac builds (3.87 KB, patch)
2016-10-10 05:13 PDT, Carlos Garcia Campos
achristensen: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2016-10-10 03:58:04 PDT
After the completion handler a reference of the NetworkDataTask is saved in m_downloadsAfterDestinationDecided. If the download failed or was canceled DownloadManager::dataTaskBecameDownloadTask is never called and the data task is kept in the download manager forever.
Comment 1 Carlos Garcia Campos 2016-10-10 04:03:14 PDT
Created attachment 291085 [details]
Patch
Comment 2 Carlos Garcia Campos 2016-10-10 05:13:37 PDT
Created attachment 291090 [details]
Try to fix mac builds
Comment 3 Alex Christensen 2016-10-10 09:21:48 PDT
Comment on attachment 291090 [details]
Try to fix mac builds

View in context: https://bugs.webkit.org/attachment.cgi?id=291090&action=review

> Source/WebKit2/ChangeLog:11
> +        NetworkDataTask, so that the download manager can check the task state after the co,pletion handler and return

completion

> Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:426
> +    ASSERT_NOT_REACHED();
> +    return State::Running;

I know this should be impossible and doesn't matter, but let's default to Completed in this case so we won't do anything.
Comment 4 Carlos Garcia Campos 2016-10-10 09:27:15 PDT
(In reply to comment #3)
> Comment on attachment 291090 [details]
> Try to fix mac builds
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=291090&action=review
> 
> > Source/WebKit2/ChangeLog:11
> > +        NetworkDataTask, so that the download manager can check the task state after the co,pletion handler and return
> 
> completion
> 
> > Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:426
> > +    ASSERT_NOT_REACHED();
> > +    return State::Running;
> 
> I know this should be impossible and doesn't matter, but let's default to
> Completed in this case so we won't do anything.

Good point
Comment 5 Carlos Garcia Campos 2016-10-10 22:31:29 PDT
Committed r207042: <http://trac.webkit.org/changeset/207042>