<?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>196260</bug_id>
          
          <creation_ts>2019-03-26 10:41:08 -0700</creation_ts>
          <short_desc>[ews] Reset simctl states on reboot</short_desc>
          <delta_ts>2019-03-26 16:22:09 -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 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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jonathan Bedard">jbedard</reporter>
          <assigned_to name="Jonathan Bedard">jbedard</assigned_to>
          <cc>aakash_jain</cc>
    
    <cc>ap</cc>
    
    <cc>commit-queue</cc>
    
    <cc>lforschler</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1521346</commentid>
    <comment_count>0</comment_count>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2019-03-26 10:41:08 -0700</bug_when>
    <thetext>It&apos;s possible for simctl to get in a pretty rotten state, especially if folks change infrastructure code in a patch. On reboot, we should do everything we can to reset simctl to a pristine state.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521364</commentid>
    <comment_count>1</comment_count>
      <attachid>365976</attachid>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2019-03-26 11:23:45 -0700</bug_when>
    <thetext>Created attachment 365976
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521374</commentid>
    <comment_count>2</comment_count>
      <attachid>365976</attachid>
    <who name="Aakash Jain">aakash_jain</who>
    <bug_when>2019-03-26 11:46:45 -0700</bug_when>
    <thetext>Comment on attachment 365976
Patch

rs=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521408</commentid>
    <comment_count>3</comment_count>
      <attachid>365990</attachid>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2019-03-26 13:01:24 -0700</bug_when>
    <thetext>Created attachment 365990
Patch for landing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521426</commentid>
    <comment_count>4</comment_count>
      <attachid>365990</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-03-26 13:42:04 -0700</bug_when>
    <thetext>Comment on attachment 365990
Patch for landing

Clearing flags on attachment: 365990

Committed r243516: &lt;https://trac.webkit.org/changeset/243516&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521427</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-03-26 13:42:06 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521432</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-03-26 13:51:09 -0700</bug_when>
    <thetext>&lt;rdar://problem/49289644&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521445</commentid>
    <comment_count>7</comment_count>
      <attachid>365990</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2019-03-26 14:17:55 -0700</bug_when>
    <thetext>Comment on attachment 365990
Patch for landing

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

&gt; Tools/EWSTools/start-queue-mac.sh:68
&gt; +/usr/bin/sudo /usr/bin/killall -9 com.apple.CoreSimulator.CoreSimulatorServer
&gt; +/usr/bin/xcrun simctl delete unavailable

How did you choose this order of operations?

If CoreSimulatorServer is restarted automatically, then we would probably want to restart it after the state is clean, not before. Although there would be races either way I think.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521509</commentid>
    <comment_count>8</comment_count>
      <attachid>365990</attachid>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2019-03-26 16:22:09 -0700</bug_when>
    <thetext>Comment on attachment 365990
Patch for landing

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

&gt;&gt; Tools/EWSTools/start-queue-mac.sh:68
&gt;&gt; +/usr/bin/xcrun simctl delete unavailable
&gt; 
&gt; How did you choose this order of operations?
&gt; 
&gt; If CoreSimulatorServer is restarted automatically, then we would probably want to restart it after the state is clean, not before. Although there would be races either way I think.

First we need to remove any corrupted devices (to do this, we remove all devices)
Second, we need to force the CoreSimulatorServer to recognize our deletions (because it won&apos;t immediately)

Last, we should remove any remaining devices that simctl thinks it has available, but aren&apos;t. This last step isn&apos;t strictly necessary to fix the problem which prompted this bug, but it&apos;s something we should have been doing in the first place. The trouble is, &apos;xcrun simctl delete unavailable&apos; will fail if it tries to delete devices corrupted in a certain way.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>365976</attachid>
            <date>2019-03-26 11:23:45 -0700</date>
            <delta_ts>2019-03-26 13:01:23 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-196260-20190326112345.patch</filename>
            <type>text/plain</type>
            <size>1161</size>
            <attacher name="Jonathan Bedard">jbedard</attacher>
            
              <data encoding="base64">SW5kZXg6IFRvb2xzL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBUb29scy9DaGFuZ2VMb2cJKHJl
dmlzaW9uIDI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9MaWJyYXJ5L0RldmVsb3Blci9Db3JlU2ltdWxhdG9yL0Rldmlj
ZXMvKgorL3Vzci9iaW4vc3VkbyAvdXNyL2Jpbi9raWxsYWxsIC05IGNvbS5hcHBsZS5Db3JlU2lt
dWxhdG9yLkNvcmVTaW11bGF0b3JTZXJ2ZXIKKy91c3IvYmluL3hjcnVuIHNpbWN0bCBkZWxldGUg
dW5hdmFpbGFibGUKKwogY2QgJFdFQktJVF9IT01FCiAKICMgRGVsZXRlIFdlYktpdEJ1aWxkIHRv
IGZvcmNlIGEgY2xlYW4gYnVpbGQK
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>365990</attachid>
            <date>2019-03-26 13:01:24 -0700</date>
            <delta_ts>2019-03-26 13:42:04 -0700</delta_ts>
            <desc>Patch for landing</desc>
            <filename>bug-196260-20190326130124.patch</filename>
            <type>text/plain</type>
            <size>1164</size>
            <attacher name="Jonathan Bedard">jbedard</attacher>
            
              <data encoding="base64">SW5kZXg6IFRvb2xzL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBUb29scy9DaGFuZ2VMb2cJKHJl
dmlzaW9uIDI0MzUwOSkKKysrIFRvb2xzL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwz
ICsxLDEyIEBACisyMDE5LTAzLTI2ICBKb25hdGhhbiBCZWRhcmQgIDxqYmVkYXJkQGFwcGxlLmNv
bT4KKworICAgICAgICBbZXdzXSBSZXNldCBzaW1jdGwgc3RhdGVzIG9uIHJlYm9vdAorICAgICAg
ICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTk2MjYwCisKKyAgICAg
ICAgUnViYmVyLXN0YW1wZWQgYnkgQWFrYXNoIEphaW4uCisKKyAgICAgICAgKiBFV1NUb29scy9z
dGFydC1xdWV1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