JOGL 平台初始化 1 分钟
JOGL Platform init 1 minute
我的 JOGL 应用程序存在加载时间长的问题。一切正常,直到昨天 canvas 初始化突然开始占用整整一分钟。罪魁祸首在本机 Platform.initSingleton() 调用内部的某个地方。
以下代码干净class
System.out.println("Start");
long t0 = System.currentTimeMillis();
AbstractGraphicsDevice device = GLProfile.getDefaultDevice();
long t1 = System.currentTimeMillis();
System.out.println((t1 - t0) + "ms " + device);
GLProfile profile = GLProfile.getDefault(device);
long t2 = System.currentTimeMillis();
System.out.println((t2 - t1) + "ms " + profile);
GLCapabilities capabilities = new GLCapabilities(profile);
long t3 = System.currentTimeMillis();
System.out.println((t3 - t2) + "ms " + capabilities);
System.out.println("Java version "+System.getProperty("java.version"));
会产生
61467ms WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x59b9040a]]
0ms GLProfile[GL4bc/GL4bc.hw]
0ms GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
Java version 1.8.0_102 / 1.8.0_121 / 1.8.0_152
我试过了
- 运行在具有相似规格的不同计算机上运行(在那里工作
很好)
- 调试以在调用中找到更具体的位置,但卡在对 Platform.initSingleton()
的本机调用中
- 运行 Platform.initSingleton() 和 -Djogamp.debug=ALL(见下文)
- 检查所有库是否与工作机器上的相同
- 正在更新 JDK 和 JRE 到最新版本
- 正在将 JDK 和 JRE 重新安装到旧版本
- 正在更新windows
- 正在将图形驱动程序更新到最新版本
- 正在将(干净的)图形驱动程序重新安装到它在其他地方工作的版本
- 根据 windows 更新历史安装了 KB4038788、KB890830 和 KB4038806,none 提示它们可能是原因
- 防火墙似乎没有阻止任何系统调用(关闭只是为了确定)
- windows defender off to be sure
- 将测试代码编译成 jar 并运行从命令行将其编译
从调试打印来看,问题似乎出在此处
IOUtil.testDirExec(): test-exe <C:\Users\User\AppData\Local\Temp\jogamp_exe_tst3558906654350516679.exe>, existingFile false, returned 0
IOUtil.testDirExec(): abs-path <C:\Users\User\AppData\Local\Temp>: res 0 -> true
IOUtil.testDirExec(): total 30033ms, create 16ms, fill 0ms, execute 30017ms
IOUtil.testDirImpl(tempX1): <C:\Users\User\AppData\Local\Temp>, create true, exec true: true
IOUtil.testDirExec(): test-exe <C:\Users\User\AppData\Local\Temp\jogamp_0000\jogamp_exe_tst3791240964894525069.exe>, existingFile false, returned 0
IOUtil.testDirExec(): abs-path <C:\Users\User\AppData\Local\Temp\jogamp_0000>: res 0 -> true
IOUtil.testDirExec(): total 30016ms, create 0ms, fill 0ms, execute 30016ms
我 运行 没主意了,我不太喜欢重新安装我的整个系统只是为了恢复的想法,可能会再次遇到它。
任何想法和经验可能会导致这种情况?我发现最有趣的是,它最终会起作用,而初始化过程只是延迟了。
使用 oracle JDK 1.8.0_102 / 1.8.0_121 / 1.8.0_152 (全部相同,几天前有 121 个工作)
已尝试驱动程序 388.13x64(最新)和 385.69x64(适用于不同机器)
编辑:它不能工作的机器有 GTX 1070,一台能工作的机器有 GTX 960。
经过更多挖掘,我发现最好的解决方案是添加
-Djogamp.gluegen.UseTempJarCache=false
JVM 参数。
引用类似的问题(问这个问题时出于某种原因我没有找到)JOGL takes too long to start
马文·梅勒:
Launching with the argument -Djogamp.gluegen.UseTempJarCache=false and
using the native libraries instead of jars has done the trick for me
(startup time from 15s+ to 500ms). It's not really a solution since
the native libraries shouldn't be used anymore but it's still enough
to debug.
原问题中的问题似乎与我的有点不同,因为我已经修复了缓存访问超时导致的 30+30 秒,而不是长时间的 运行 反病毒检查。
我的 JOGL 应用程序存在加载时间长的问题。一切正常,直到昨天 canvas 初始化突然开始占用整整一分钟。罪魁祸首在本机 Platform.initSingleton() 调用内部的某个地方。
以下代码干净class
System.out.println("Start");
long t0 = System.currentTimeMillis();
AbstractGraphicsDevice device = GLProfile.getDefaultDevice();
long t1 = System.currentTimeMillis();
System.out.println((t1 - t0) + "ms " + device);
GLProfile profile = GLProfile.getDefault(device);
long t2 = System.currentTimeMillis();
System.out.println((t2 - t1) + "ms " + profile);
GLCapabilities capabilities = new GLCapabilities(profile);
long t3 = System.currentTimeMillis();
System.out.println((t3 - t2) + "ms " + capabilities);
System.out.println("Java version "+System.getProperty("java.version"));
会产生
61467ms WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x59b9040a]]
0ms GLProfile[GL4bc/GL4bc.hw]
0ms GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
Java version 1.8.0_102 / 1.8.0_121 / 1.8.0_152
我试过了
- 运行在具有相似规格的不同计算机上运行(在那里工作 很好)
- 调试以在调用中找到更具体的位置,但卡在对 Platform.initSingleton() 的本机调用中
- 运行 Platform.initSingleton() 和 -Djogamp.debug=ALL(见下文)
- 检查所有库是否与工作机器上的相同
- 正在更新 JDK 和 JRE 到最新版本
- 正在将 JDK 和 JRE 重新安装到旧版本
- 正在更新windows
- 正在将图形驱动程序更新到最新版本
- 正在将(干净的)图形驱动程序重新安装到它在其他地方工作的版本
- 根据 windows 更新历史安装了 KB4038788、KB890830 和 KB4038806,none 提示它们可能是原因
- 防火墙似乎没有阻止任何系统调用(关闭只是为了确定)
- windows defender off to be sure
- 将测试代码编译成 jar 并运行从命令行将其编译
从调试打印来看,问题似乎出在此处
IOUtil.testDirExec(): test-exe <C:\Users\User\AppData\Local\Temp\jogamp_exe_tst3558906654350516679.exe>, existingFile false, returned 0
IOUtil.testDirExec(): abs-path <C:\Users\User\AppData\Local\Temp>: res 0 -> true
IOUtil.testDirExec(): total 30033ms, create 16ms, fill 0ms, execute 30017ms
IOUtil.testDirImpl(tempX1): <C:\Users\User\AppData\Local\Temp>, create true, exec true: true
IOUtil.testDirExec(): test-exe <C:\Users\User\AppData\Local\Temp\jogamp_0000\jogamp_exe_tst3791240964894525069.exe>, existingFile false, returned 0
IOUtil.testDirExec(): abs-path <C:\Users\User\AppData\Local\Temp\jogamp_0000>: res 0 -> true
IOUtil.testDirExec(): total 30016ms, create 0ms, fill 0ms, execute 30016ms
我 运行 没主意了,我不太喜欢重新安装我的整个系统只是为了恢复的想法,可能会再次遇到它。
任何想法和经验可能会导致这种情况?我发现最有趣的是,它最终会起作用,而初始化过程只是延迟了。
使用 oracle JDK 1.8.0_102 / 1.8.0_121 / 1.8.0_152 (全部相同,几天前有 121 个工作) 已尝试驱动程序 388.13x64(最新)和 385.69x64(适用于不同机器)
编辑:它不能工作的机器有 GTX 1070,一台能工作的机器有 GTX 960。
经过更多挖掘,我发现最好的解决方案是添加
-Djogamp.gluegen.UseTempJarCache=false
JVM 参数。
引用类似的问题(问这个问题时出于某种原因我没有找到)JOGL takes too long to start
马文·梅勒:
Launching with the argument -Djogamp.gluegen.UseTempJarCache=false and using the native libraries instead of jars has done the trick for me (startup time from 15s+ to 500ms). It's not really a solution since the native libraries shouldn't be used anymore but it's still enough to debug.
原问题中的问题似乎与我的有点不同,因为我已经修复了缓存访问超时导致的 30+30 秒,而不是长时间的 运行 反病毒检查。