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

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>1028</bug_id>
          
          <creation_ts>2014-07-04 00:19:50 +0200</creation_ts>
          <short_desc>AMD Windows driver thread hinders JVM process to exit/end, caused by _not_ destroying the SharedResource context</short_desc>
          <delta_ts>2014-08-08 15:16:43 +0200</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>core</component>
          <version>2</version>
          <rep_platform>pc_x86_64</rep_platform>
          <op_sys>windows</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="raptor">zapubliku</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>askinner</cc>
    
    <cc>bardackx</cc>
    
    <cc>rene</cc>
    
    <cc>sgothel</cc>
    
    <cc>wwalker3</cc>
    
    <cc>zapubliku</cc>
          
          <cf_type>DEFECT</cf_type>
          <cf_scm_refs>b66b068b5c1c238ea702ba7e8ea0c8a1c47cfcf1</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>4005</commentid>
    <comment_count>0</comment_count>
    <who name="raptor">zapubliku</who>
    <bug_when>2014-07-04 00:19:50 +0200</bug_when>
    <thetext>When running the code below, javaw.exe does not terminate on some environments. 

public static void main(String[] args) {
      GLProfile glpMinimal = GLProfile.get(GLProfile.GL2);
} 

This can be reproduced on the below environment and is not an issue for everybody.
It appears to be related to ATI type drivers.

* Eclipse: Version: Kepler Service Release 1  Build id: 20130919-0819
* Win 7 64 bit
* Java 1.7.0_51 64 
* ATI Catalyst drivers (14.4)


Some more info:
I did some more digging and it seams the issues is when the  function below in the JOGL API is called (seams some racing issue) :

jogamp.opengl.GLDrawableFactoryImpl.getOrCreateSharedResource

  protected final SharedResourceRunner.Resource getOrCreateSharedResource(AbstractGraphicsDevice device) {
      try {
          device = validateDevice(device);
          if( null != device) {
              return getOrCreateSharedResourceImpl( device );
          }
      } catch (GLException gle) {
          if(DEBUG) {
              System.err.println(&quot;Catched Exception on thread &quot;+getThreadName());
              gle.printStackTrace();
          }
      }
      return null;
  }

If I replace the bold section with null, it will shutdown OK.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4007</commentid>
    <comment_count>1</comment_count>
    <who name="raptor">zapubliku</who>
    <bug_when>2014-07-07 12:12:59 +0200</bug_when>
    <thetext>I Forgot to clarify the bold section.

If 
&quot;return getOrCreateSharedResourceImpl( device );&quot; 
is replaced with &quot;return null&quot; 
javaw.exe will close.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4026</commentid>
    <comment_count>2</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2014-07-13 22:19:19 +0200</bug_when>
    <thetext>I&apos;ve tried to duplicate this on Windows 8 with nvidia drivers and eclipse 3.8.2, but I don&apos;t see the behavior. It looks like there&apos;s another user in the forum with this bug, I&apos;ve asked him to enter his version info here to see if there&apos;s a pattern.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4079</commentid>
    <comment_count>3</comment_count>
    <who name="Rene">rene</who>
    <bug_when>2014-08-05 14:09:39 +0200</bug_when>
    <thetext>I can confirm that this happens for me as well, it is not limited to eclipse it does the same if you run it as a standalone app.

I have tried this on two other computers with Nvidia graphics and it seems to work fine on those.

Win 7 64 bit
ATI Catalyst Drivers 14.4
Java 1.7.0_65
JOGL 2.1.5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4080</commentid>
    <comment_count>4</comment_count>
    <who name="Rene">rene</who>
    <bug_when>2014-08-05 14:17:05 +0200</bug_when>
    <thetext>My graphics card: AMD Radeon HD 5670</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4081</commentid>
    <comment_count>5</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-08-05 17:05:49 +0200</bug_when>
    <thetext>SharedResourceRunner stop() method
is invoked by JMV shutdown hook and GLProfile/GLDrawableFactory.shutdown*().

It shall issue SharedResource.releaseSharedResource() for all implementations,
e.g. X11/GLX and Windows/WGL.

+++

Root cause is a GL driver thread keeping the process alive.

+++

On X11/GLX we destroy the shared context and the shared drawable.

On Windows/WGL we only destroy the shared drawable,
knowing that destroying the shared context caused a driver bug in the past.

Will enable the shared context destruction, which is the proper way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4082</commentid>
    <comment_count>6</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-08-05 17:06:22 +0200</bug_when>
    <thetext>(In reply to comment #5)
&gt; 
&gt; +++
&gt; 
&gt; Root cause is a GL driver thread keeping the process alive.

Confirmed for AMD Windows driver &gt;= 14.4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4083</commentid>
    <comment_count>7</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-08-05 17:11:13 +0200</bug_when>
    <thetext>b66b068b5c1c238ea702ba7e8ea0c8a1c47cfcf1
  Enabling the SharedResource context destruction.

  Commiting this patch to see whether our jenkins builds won&apos;t crash
  due to previous experienced issues.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4085</commentid>
    <comment_count>8</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-08-05 20:34:15 +0200</bug_when>
    <thetext>(In reply to comment #7)
&gt; b66b068b5c1c238ea702ba7e8ea0c8a1c47cfcf1
&gt;   Enabling the SharedResource context destruction.
&gt; 
&gt;   Commiting this patch to see whether our jenkins builds won&apos;t crash
&gt;   due to previous experienced issues.

All jenkins builds and tests passed,
leaving this patch &apos;in&apos;, which hopefully fixes the AMD Windows driver bug.

The latter is responsible for keeping the process alive
if an &apos;off-thread&apos; context is not being destroyed.

&apos;off-thread&apos; is mentioned, since we haven&apos;t tested with an 
&apos;on-thread&apos; situation.

Aggregated build here:
  &lt;http://jogamp.org/deployment/archive/master/gluegen_813-joal_557-jogl_1325-jocl_996/&gt;

Test results from jenkins showing no regressions:
  &lt;https://jogamp.org/chuck/view/fwd/job/jogl/1325/&gt;

I close this bug for now.

If this change works and solves this issue, please confirm.

If this changes does not solve this issue,
PLEASE REOPEN!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4096</commentid>
    <comment_count>9</comment_count>
    <who name="Gustavo Arias">bardackx</who>
    <bug_when>2014-08-08 15:16:43 +0200</bug_when>
    <thetext>(In reply to comment #8)
&gt; (In reply to comment #7)
&gt; &gt; b66b068b5c1c238ea702ba7e8ea0c8a1c47cfcf1
&gt; &gt;   Enabling the SharedResource context destruction.
&gt; &gt; 
&gt; &gt;   Commiting this patch to see whether our jenkins builds won&apos;t crash
&gt; &gt;   due to previous experienced issues.
&gt; 
&gt; All jenkins builds and tests passed,
&gt; leaving this patch &apos;in&apos;, which hopefully fixes the AMD Windows driver bug.
&gt; 
&gt; The latter is responsible for keeping the process alive
&gt; if an &apos;off-thread&apos; context is not being destroyed.
&gt; 
&gt; &apos;off-thread&apos; is mentioned, since we haven&apos;t tested with an 
&gt; &apos;on-thread&apos; situation.
&gt; 
&gt; Aggregated build here:
&gt;  
&gt; &lt;http://jogamp.org/deployment/archive/master/gluegen_813-joal_557-jogl_1325-
&gt; jocl_996/&gt;
&gt; 
&gt; Test results from jenkins showing no regressions:
&gt;   &lt;https://jogamp.org/chuck/view/fwd/job/jogl/1325/&gt;
&gt; 
&gt; I close this bug for now.
&gt; 
&gt; If this change works and solves this issue, please confirm.
&gt; 
&gt; If this changes does not solve this issue,
&gt; PLEASE REOPEN!

It works and solves the issue for me</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>