<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>171616</bug_id>
          
          <creation_ts>2017-05-03 13:59:14 -0700</creation_ts>
          <short_desc>REGRESSION (r216129): ASSERTION FAILED: m_process-&gt;state() == WebProcessProxy::State::Terminated</short_desc>
          <delta_ts>2017-05-03 21:37:41 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>171565</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryan Haddad">ryanhaddad</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>andersca</cc>
    
    <cc>beidson</cc>
    
    <cc>cdumez</cc>
    
    <cc>ggaren</cc>
    
    <cc>jlewis3</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1304225</commentid>
    <comment_count>0</comment_count>
    <who name="Ryan Haddad">ryanhaddad</who>
    <bug_when>2017-05-03 13:59:14 -0700</bug_when>
    <thetext>Tests that failed:
  WebKit2.ReloadPageAfterCrash
  WebKit2.ResizeWindowAfterCrash

UNEXPECTEDLY EXITED WebKit2.ReloadPageAfterCrash
ASSERTION FAILED: m_process-&gt;state() == WebProcessProxy::State::Terminated
/Volumes/Data/slave/sierra-debug/build/Source/WebKit2/UIProcess/WebPageProxy.cpp(707) : void WebKit::WebPageProxy::reattachToWebProcess()
1   0x1080a2f1d WTFCrash
2   0x10dafa073 WebKit::WebPageProxy::reattachToWebProcess()
3   0x10dafe4ce WebKit::WebPageProxy::loadRequest(WebCore::ResourceRequest const&amp;, WebCore::ShouldOpenExternalURLsPolicy, API::Object*)
4   0x10dee689b WKPageLoadURL
5   0x1065c97ea TestWebKitAPI::WebKit2_ReloadPageAfterCrash_Test::TestBody()
6   0x10671d7aa testing::Test::Run()
7   0x10671e5dd testing::internal::TestInfoImpl::Run()
8   0x10671f5dd testing::TestCase::Run()
9   0x106725d1b testing::internal::UnitTestImpl::RunAllTests()
10  0x106725999 testing::UnitTest::Run()
11  0x10661242c TestWebKitAPI::TestsController::run(int, char**)
12  0x1066ed8df main
13  0x7fffa4e93235 start
14  0x2

UNEXPECTEDLY EXITED WebKit2.ResizeWindowAfterCrash
ASSERTION FAILED: m_process-&gt;state() == WebProcessProxy::State::Terminated
/Volumes/Data/slave/sierra-debug/build/Source/WebKit2/UIProcess/WebPageProxy.cpp(707) : void WebKit::WebPageProxy::reattachToWebProcess()
1   0x10dc53f1d WTFCrash
2   0x111d22073 WebKit::WebPageProxy::reattachToWebProcess()
3   0x111d264ce WebKit::WebPageProxy::loadRequest(WebCore::ResourceRequest const&amp;, WebCore::ShouldOpenExternalURLsPolicy, API::Object*)
4   0x11210e89b WKPageLoadURL
5   0x10c183c39 TestWebKitAPI::WebKit2_ResizeWindowAfterCrash_Test::TestBody()
6   0x10c2ce7aa testing::Test::Run()
7   0x10c2cf5dd testing::internal::TestInfoImpl::Run()
8   0x10c2d05dd testing::TestCase::Run()
9   0x10c2d6d1b testing::internal::UnitTestImpl::RunAllTests()
10  0x10c2d6999 testing::UnitTest::Run()
11  0x10c1c342c TestWebKitAPI::TestsController::run(int, char**)
12  0x10c29e8df main
13  0x7fffa4e93235 start
14  0x2

https://build.webkit.org/builders/Apple%20Sierra%20Debug%20WK1%20%28Tests%29/builds/946/steps/run-api-tests/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304226</commentid>
    <comment_count>1</comment_count>
    <who name="Ryan Haddad">ryanhaddad</who>
    <bug_when>2017-05-03 13:59:34 -0700</bug_when>
    <thetext>Started with https://trac.webkit.org/changeset/216129/webkit</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304231</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-05-03 14:04:40 -0700</bug_when>
    <thetext>(In reply to Ryan Haddad from comment #1)
&gt; Started with https://trac.webkit.org/changeset/216129/webkit

Looking now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304240</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-05-03 14:19:31 -0700</bug_when>
    <thetext>Those 2 API tests do the same thing:
WKPageTerminate()
WKPageLoadURL()

and in their didCrash() handler, they call WKPageReload().

so when the didCrash handler gets called, we have already started a load.

The reason this started failing with my patch is that before r216129, the processDidCrash delegates were not called as a result to calls to WKPageTerminate().

I did it in r216129 so I could test my new processDidCrash delegate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304243</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-05-03 14:22:33 -0700</bug_when>
    <thetext>The issue seems to be here:
void WebPageProxy::terminateProcess()
{
    // NOTE: This uses a check of m_isValid rather than calling isValid() since
    // we want this to run even for pages being closed or that already closed.
    if (!m_isValid)
        return;

    m_process-&gt;requestTermination();
    resetStateAfterProcessExited();
}

We call resetStateAfterProcessExited() after calling requestTermination(). However, after r216129, requestTermination() ends up calling the processDidCrash delegate before we get a chance to reset the state.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304245</commentid>
    <comment_count>5</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-05-03 14:24:15 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #4)
&gt; The issue seems to be here:
&gt; void WebPageProxy::terminateProcess()
&gt; {
&gt;     // NOTE: This uses a check of m_isValid rather than calling isValid()
&gt; since
&gt;     // we want this to run even for pages being closed or that already
&gt; closed.
&gt;     if (!m_isValid)
&gt;         return;
&gt; 
&gt;     m_process-&gt;requestTermination();
&gt;     resetStateAfterProcessExited();
&gt; }
&gt; 
&gt; We call resetStateAfterProcessExited() after calling requestTermination().
&gt; However, after r216129, requestTermination() ends up calling the
&gt; processDidCrash delegate before we get a chance to reset the state.

It seems we do not need to call resetStateAfterProcessExited() at all in WebPageProxy::terminateProcess() since requestTermination() will call WebPageProxy::processDidCrash(), which already calls resetStateAfterProcessExited().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304246</commentid>
    <comment_count>6</comment_count>
      <attachid>308953</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-05-03 14:27:05 -0700</bug_when>
    <thetext>Created attachment 308953
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304247</commentid>
    <comment_count>7</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-05-03 14:27:23 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #6)
&gt; Created attachment 308953 [details]
&gt; Patch

Still building locally to confirm the fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304254</commentid>
    <comment_count>8</comment_count>
      <attachid>308953</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-05-03 14:36:38 -0700</bug_when>
    <thetext>Comment on attachment 308953
Patch

API tests are passing in Debug locally with this fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304274</commentid>
    <comment_count>9</comment_count>
      <attachid>308953</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-05-03 14:56:38 -0700</bug_when>
    <thetext>Comment on attachment 308953
Patch

Clearing flags on attachment: 308953

Committed r216144: &lt;http://trac.webkit.org/changeset/216144&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304275</commentid>
    <comment_count>10</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-05-03 14:56:40 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304360</commentid>
    <comment_count>11</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-05-03 16:26:41 -0700</bug_when>
    <thetext>&gt; before r216129, the processDidCrash delegates were not called as a result to calls to WKPageTerminate()

That seems like correct behavior; changing it just for testing doesn&apos;t sound right. One can always send a kill signal to properly simulate a crash, termination is not a crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304510</commentid>
    <comment_count>12</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-05-03 21:37:41 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #11)
&gt; &gt; before r216129, the processDidCrash delegates were not called as a result to calls to WKPageTerminate()
&gt; 
&gt; That seems like correct behavior; changing it just for testing doesn&apos;t sound
&gt; right. One can always send a kill signal to properly simulate a crash,
&gt; termination is not a crash.

Addressing feedback via https://bugs.webkit.org/show_bug.cgi?id=171624.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>308953</attachid>
            <date>2017-05-03 14:27:05 -0700</date>
            <delta_ts>2017-05-03 14:56:38 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-171616-20170503142704.patch</filename>
            <type>text/plain</type>
            <size>1741</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjE2MTMwCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0Mi9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViS2l0Mi9DaGFuZ2VMb2cKaW5kZXggZmY0MDkyNGM5ODliMTM5
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