<?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>229706</bug_id>
          
          <creation_ts>2021-08-31 03:24:43 -0700</creation_ts>
          <short_desc>REGRESSION (Safari 14): webgl_loader_texture_basis three.js example sometimes fails</short_desc>
          <delta_ts>2021-10-27 00:46:32 -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>WebKit2</component>
          <version>Safari 14</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 14</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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="Michael Herzog">michael.herzog</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>achristensen</cc>
    
    <cc>ap</cc>
    
    <cc>blascoburguillos</cc>
    
    <cc>cdumez</cc>
    
    <cc>dino</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1788851</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Herzog">michael.herzog</who>
    <bug_when>2021-08-31 03:24:43 -0700</bug_when>
    <thetext>The following example pages decodes a texture in a web worker, transfers the result into the main thread via &quot;postMessage()&quot; and then renders the result on a plane.

https://threejs.org/examples/webgl_loader_texture_basis

Expected behavior: The texture is always rendered correctly.

Actual behavior: Sometimes the plane is white since no texture is applied. This only happens sporadicly (maybe one out of ten reloads).

A user at GitHub found out that the root cause of this issue is a missing message from the worker. Meaning the worker sends the message but it never reaches the main thread.

https://github.com/mrdoob/three.js/issues/19717#issuecomment-653581829

This issue only happens in WebKit based browsers on iOS, iPadOS and macOS.

According to the comments at GitHub the example used to work consistently in earlier version of Safari (meaning &lt; 14).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1790328</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-09-03 13:19:47 -0700</bug_when>
    <thetext>Thank you for the bug report and the test site. It looks like I can I am able to reproduce on Safari 15 on macOS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1790338</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-09-03 13:39:37 -0700</bug_when>
    <thetext>Hmm, I see the page sending 2 messages to the worker and us dispatching those 2 message events on the WorkerGlobalScope. However, I do not see any messages being sent *from* the worker (no WorkerGlobalScope.postMessage() or MessagePort.postMessage() calls).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1790369</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-09-03 14:39:52 -0700</bug_when>
    <thetext>I don&apos;t think this is an issue with postMessage(). The worker simply doesn&apos;t call postMessage() to send back the results, even though it received 2 messages from the main thread. 

So presumably, whatever operation is happening between the worker receiving the messages and the worker calling postMessage() with the results is getting stuck, sometimes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1790393</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-09-03 15:02:11 -0700</bug_when>
    <thetext>Since canvas is involved, I tried disabling the GPU process but it didn&apos;t help.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1790528</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Herzog">michael.herzog</who>
    <bug_when>2021-09-05 01:08:35 -0700</bug_when>
    <thetext>The worker definitely calls &quot;postMessage()&quot; at this place: https://github.com/mrdoob/three.js/blob/105bd07ffce14f8f8982417e16b99c0d066ce3f1/examples/jsm/loaders/BasisTextureLoader.js#L418

Interestingly, when I add a console.log() right before this line, you see a console log when the demo works. However, when the plane keeps white (so when the issue appears), there is no log in the console.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1790580</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2021-09-05 14:59:12 -0700</bug_when>
    <thetext>Re-titling to say what we know about the issue, as it&apos;s been demonstrated to NOT be related to postMessage(), given that the execution doesn&apos;t even reach postMessage() in the worker.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1790926</commentid>
    <comment_count>7</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-09-07 03:25:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/82814418&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1809194</commentid>
    <comment_count>8</comment_count>
    <who name="">blascoburguillos</who>
    <bug_when>2021-10-27 00:46:32 -0700</bug_when>
    <thetext>I´m also experiencing this issue. Any news or updates?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>