Bug 163576

Summary: WTF should make it easier to create threads that die automatically after inactivity
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: Web Template FrameworkAssignee: Filip Pizlo <fpizlo>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 163562, 163615    
Attachments:
Description Flags
it begins
none
seems to work
kling: review+
the patch none

Description Filip Pizlo 2016-10-17 17:55:25 PDT
Patch forthcoming.
Comment 1 Filip Pizlo 2016-10-17 18:38:02 PDT
Created attachment 291908 [details]
it begins
Comment 2 Filip Pizlo 2016-10-18 11:55:20 PDT
Created attachment 291964 [details]
seems to work

Obviously, I have to test this more.  But it seems to work so far.  It's really exciting to see it stop and then restart its threads.
Comment 3 Filip Pizlo 2016-10-18 12:01:26 PDT
Comment on attachment 291964 [details]
seems to work

This is meant to be ready for review.
Comment 4 WebKit Commit Bot 2016-10-18 12:03:58 PDT
Attachment 291964 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/AutomaticThread.h:26:  Use #pragma once instead of #ifndef for header guard.  [build/header_guard] [5]
ERROR: Source/WTF/wtf/ParallelHelperPool.cpp:203:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WTF/wtf/AutomaticThread.cpp:100:  'preserveThisForThread' is incorrectly named. It should be named 'protectedThis'.  [readability/naming/protected] [4]
ERROR: Source/WTF/wtf/AutomaticThread.cpp:107:  'preserveThisInThread' is incorrectly named. It should be named 'protector' or 'protectedPreserveThisForThread'.  [readability/naming/protected] [4]
ERROR: Source/WTF/wtf/AutomaticThread.cpp:120:  This { should be at the end of the previous line  [whitespace/braces] [4]
Total errors found: 5 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Andreas Kling 2016-10-18 12:16:46 PDT
Comment on attachment 291964 [details]
seems to work

r=me.
This is a really nice and clean solution to an issue we've had for ages. Can't wait to see some nice and short crash dumps :)
Comment 6 Filip Pizlo 2016-10-18 12:23:52 PDT
Created attachment 291967 [details]
the patch
Comment 7 Filip Pizlo 2016-10-18 12:24:06 PDT
Comment on attachment 291967 [details]
the patch

Already reviewed, did not mean to r?
Comment 8 WebKit Commit Bot 2016-10-18 12:26:27 PDT
Attachment 291967 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/AutomaticThread.h:26:  Use #pragma once instead of #ifndef for header guard.  [build/header_guard] [5]
ERROR: Source/WTF/wtf/ParallelHelperPool.cpp:203:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WTF/wtf/AutomaticThread.cpp:100:  'preserveThisForThread' is incorrectly named. It should be named 'protectedThis'.  [readability/naming/protected] [4]
ERROR: Source/WTF/wtf/AutomaticThread.cpp:107:  'preserveThisInThread' is incorrectly named. It should be named 'protector' or 'protectedPreserveThisForThread'.  [readability/naming/protected] [4]
ERROR: Source/WTF/wtf/AutomaticThread.cpp:120:  This { should be at the end of the previous line  [whitespace/braces] [4]
Total errors found: 5 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Filip Pizlo 2016-10-18 13:20:10 PDT
Landed in https://trac.webkit.org/changeset/207480
Comment 10 Geoffrey Garen 2016-10-18 14:08:28 PDT
Comment on attachment 291967 [details]
the patch

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

Aww yiss!

> Source/WTF/wtf/AutomaticThread.cpp:130
> +                        double timeout = monotonicallyIncreasingTime() + 1;

This probably needs to be a bit longer. FWIW, experiment shows that libdispatch uses 4s.
Comment 11 Filip Pizlo 2016-10-18 19:38:44 PDT
(In reply to comment #10)
> Comment on attachment 291967 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=291967&action=review
> 
> Aww yiss!
> 
> > Source/WTF/wtf/AutomaticThread.cpp:130
> > +                        double timeout = monotonicallyIncreasingTime() + 1;
> 
> This probably needs to be a bit longer. FWIW, experiment shows that
> libdispatch uses 4s.

If this patch is not a regression, then I think 1sec is good.  So far, I'm not seeing any hints of regression.  It was neutral when I tested locally, and the bots that have come back with data agree that it is neutral.
Comment 12 Filip Pizlo 2016-10-18 19:39:19 PDT
(In reply to comment #11)
> (In reply to comment #10)
> > Comment on attachment 291967 [details]
> > the patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=291967&action=review
> > 
> > Aww yiss!
> > 
> > > Source/WTF/wtf/AutomaticThread.cpp:130
> > > +                        double timeout = monotonicallyIncreasingTime() + 1;
> > 
> > This probably needs to be a bit longer. FWIW, experiment shows that
> > libdispatch uses 4s.
> 
> If this patch is not a regression, then I think 1sec is good.  So far, I'm
> not seeing any hints of regression.  It was neutral when I tested locally,
> and the bots that have come back with data agree that it is neutral.

Of course, that may change with https://bugs.webkit.org/show_bug.cgi?id=163615.