Bug 163576 - WTF should make it easier to create threads that die automatically after inactivity
Summary: WTF should make it easier to create threads that die automatically after inac...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks: 163562 163615
  Show dependency treegraph
 
Reported: 2016-10-17 17:55 PDT by Filip Pizlo
Modified: 2016-10-18 19:39 PDT (History)
1 user (show)

See Also:


Attachments
it begins (25.00 KB, patch)
2016-10-17 18:38 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff
seems to work (30.95 KB, patch)
2016-10-18 11:55 PDT, Filip Pizlo
kling: review+
Details | Formatted Diff | Diff
the patch (31.62 KB, patch)
2016-10-18 12:23 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.