<?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>171463</bug_id>
          
          <creation_ts>2017-04-28 16:47:42 -0700</creation_ts>
          <short_desc>EWS QueueServer shouldn&apos;t fail to release patch if last_status is None</short_desc>
          <delta_ts>2018-06-22 17:41:04 -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>Tools / Tests</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>186748</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Aakash Jain">aakash_jain</reporter>
          <assigned_to name="Aakash Jain">aakash_jain</assigned_to>
          <cc>aakash_jain</cc>
    
    <cc>ap</cc>
    
    <cc>dbates</cc>
    
    <cc>dewei_zhu</cc>
    
    <cc>lforschler</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1302869</commentid>
    <comment_count>0</comment_count>
    <who name="Aakash Jain">aakash_jain</who>
    <bug_when>2017-04-28 16:47:42 -0700</bug_when>
    <thetext>Noticed following error in logs:

ERROR    2017-04-28 16:34:57,859 cgi.py:121] Traceback (most recent call last): 
  File &quot;/var/apps/webkit-queues/app/main.py&quot;, line 90, in main
    run_wsgi_app(application)
  File &quot;/root/appscale/AppServer/google/appengine/ext/webapp/util.py&quot;, line 98, in run_wsgi_app
    run_bare_wsgi_app(add_wsgi_middleware(application))
  File &quot;/root/appscale/AppServer/google/appengine/ext/webapp/util.py&quot;, line 116, in run_bare_wsgi_app
    result = application(env, _start_response)
  File &quot;/root/appscale/AppServer/lib/webapp2-2.3/webapp2.py&quot;, line 1519, in __call__
    response = self._internal_error(e)
  File &quot;/root/appscale/AppServer/lib/webapp2-2.3/webapp2.py&quot;, line 1511, in __call__
    rv = self.handle_exception(request, response, e)
  File &quot;/root/appscale/AppServer/lib/webapp2-2.3/webapp2.py&quot;, line 1505, in __call__
    rv = self.router.dispatch(request, response)
  File &quot;/root/appscale/AppServer/lib/webapp2-2.3/webapp2.py&quot;, line 1253, in default_dispatcher
    return route.handler_adapter(request, response)
  File &quot;/root/appscale/AppServer/lib/webapp2-2.3/webapp2.py&quot;, line 1077, in __call__
    return handler.dispatch()
  File &quot;/root/appscale/AppServer/lib/webapp2-2.3/webapp2.py&quot;, line 547, in dispatch
    return self.handle_exception(e, self.app.debug)
  File &quot;/root/appscale/AppServer/lib/webapp2-2.3/webapp2.py&quot;, line 545, in dispatch
    return method(*args, **kwargs)
  File &quot;/var/apps/webkit-queues/app/handlers/releasepatch.py&quot;, line 58, in post
    RecordPatchEvent.stopped(attachment_id, queue_name, last_status.message)
AttributeError: &apos;NoneType&apos; object has no attribute &apos;message&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1302870</commentid>
    <comment_count>1</comment_count>
      <attachid>308615</attachid>
    <who name="Aakash Jain">aakash_jain</who>
    <bug_when>2017-04-28 16:51:07 -0700</bug_when>
    <thetext>Created attachment 308615
Proposed patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1303574</commentid>
    <comment_count>2</comment_count>
      <attachid>308615</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-05-01 21:27:50 -0700</bug_when>
    <thetext>Comment on attachment 308615
Proposed patch

Why is this message being recorded by  61        RecordPatchEvent.stopped in the first place? I&apos;m trying to understand what problems code down the line could hit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1303864</commentid>
    <comment_count>3</comment_count>
    <who name="Aakash Jain">aakash_jain</who>
    <bug_when>2017-05-02 15:57:18 -0700</bug_when>
    <thetext>The exception happened while trying to access &quot;last_status.message&quot;, while last_status was None. 

I believe last_status was None, because the slave machine, for some reason tried to release the patch immediately after starting it (See &lt;rdar://problem/31894087&gt;). So, there was no last_status for this patch on the server. And so accessing last_status.message causes exception.

This patch simply check if last_status is None and handles it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1303879</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-05-02 16:26:20 -0700</bug_when>
    <thetext>With the fix, we will be recording an event with an empty message. Where is this message used? Is it OK to have an empty one?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1303913</commentid>
    <comment_count>5</comment_count>
    <who name="Aakash Jain">aakash_jain</who>
    <bug_when>2017-05-02 18:30:05 -0700</bug_when>
    <thetext>I tried to test this change with different message (instead of empty) and couldn&apos;t find that message anywhere (atleast not in UI). This probably just go in the database.

last_status being None seems like a major problem with the patch. I believe, it happens when the patch is not processed at all (and directly released), possibly because ews was not able to parse the bug id properly. e.g.: https://bugs.webkit.org/show_bug.cgi?id=170094

If you prefer, instead of empty message, we can keep the message something like &quot;Unexpected error&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1304043</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-05-03 09:19:03 -0700</bug_when>
    <thetext>I don&apos;t have a preference for what message to write without knowing where it goes. If it doesn&apos;t go anywhere, can we just remove it from all calls to stopped()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1364336</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-10-25 11:28:38 -0700</bug_when>
    <thetext>Assuming that the problem is still happening, what&apos;s the right way to fix it? Should we go with this patch, or stop attempting to produce this message?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1364348</commentid>
    <comment_count>8</comment_count>
    <who name="Aakash Jain">aakash_jain</who>
    <bug_when>2017-10-25 11:39:33 -0700</bug_when>
    <thetext>This is a corner case, this should still be happening. This happens when EWS process a bug which which have another bug id in the bug title (e.g.: https://bugs.webkit.org/show_bug.cgi?id=170094).

See &lt;rdar://problem/31894087&gt;.

I would still like to land this patch as is. I think this is definitely an improvement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1364475</commentid>
    <comment_count>9</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-10-25 14:25:00 -0700</bug_when>
    <thetext>I think that I&apos;d still like to understand where the message is visible to the user to meaningfully review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1435713</commentid>
    <comment_count>10</comment_count>
      <attachid>308615</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2018-06-22 17:40:53 -0700</bug_when>
    <thetext>Comment on attachment 308615
Proposed patch

last_status.message is None if an EWS bot chose to skip a patch before it committed to take it (see AbstractPatchQueue._next_patch()). The EWS bot will skip the patch if it failed to fetch it from Bugzilla (say, Bugzilla was down or returned a bad response). When this happens the EWS bot does not post a status update that it skipped the patch before it tells the status server to release the patch. Instead the EWS should post a status update that it has skipped the patch like it does when it skips a patch that it committed to processing. See the ChaneLog entry in the patch on bug #186748 for more details.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1435714</commentid>
    <comment_count>11</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2018-06-22 17:41:04 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 186748 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>308615</attachid>
            <date>2017-04-28 16:51:07 -0700</date>
            <delta_ts>2018-06-22 17:40:53 -0700</delta_ts>
            <desc>Proposed patch</desc>
            <filename>patch_ews_last_status_null</filename>
            <type>text/plain</type>
            <size>1613</size>
            <attacher name="Aakash Jain">aakash_jain</attacher>
            
              <data encoding="base64">SW5kZXg6IFRvb2xzL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBUb29scy9DaGFuZ2VMb2cJKHJl
dmlzaW9uIDIxNTk1NykKKysrIFRvb2xzL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwz
ICsxLDEzIEBACisyMDE3LTA0LTI4ICBBYWthc2ggSmFpbiAgPGFha2FzaF9qYWluQGFwcGxlLmNv
bT4KKworICAgICAgICBFV1MgUXVldWVTZXJ2ZXIgc2hvdWxkbid0IGZhaWwgdG8gcmVsZWFzZSBw
YXRjaCBpZiBsYXN0X3N0YXR1cyBpcyBOb25lCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQu
b3JnL3Nob3dfYnVnLmNnaT9pZD0xNzE0NjMKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkg
KE9PUFMhKS4KKworICAgICAgICAqIFF1ZXVlU3RhdHVzU2VydmVyL2hhbmRsZXJzL3JlbGVhc2Vw
YXRjaC5weToKKyAgICAgICAgKFJlbGVhc2VQYXRjaC5wb3N0KTogQWNjZXNzIGxhc3Rfc3RhdHVz
Lm1lc3NhZ2Ugb25seSBpZiBsYXN0X3N0YXR1cyBpcyBub3QgTm9uZS4KKwogMjAxNy0wNC0yOCAg
Sm9uYXRoYW4gQmVkYXJkICA8amJlZGFyZEBhcHBsZS5jb20+CiAKICAgICAgICAgVW5yZXZpZXdl
ZCBmb2xsb3ctdXAgdG8gcjIxNDcwNS4KSW5kZXg6IFRvb2xzL1F1ZXVlU3RhdHVzU2VydmVyL2hh
bmRsZXJzL3JlbGVhc2VwYXRjaC5weQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT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3dvcmtfaXRlbXMoKS5leHBpcmVfaXRl
bShhdHRhY2htZW50X2lkKQo=
</data>
<flag name="review"
          id="329756"
          type_id="1"
          status="-"
          setter="dbates"
    />
    <flag name="commit-queue"
          id="329757"
          type_id="3"
          status="-"
          setter="dbates"
    />
          </attachment>
      

    </bug>

</bugzilla>