java XReply()以XIOError()终止应用程序
我们正在开发一些复杂的应用程序,它由linux二进制文件和java jni调用(来自用linux二进制文件创建的JVM)集成而成,这些调用来自我们定制的应用程序。jar文件。所有gui工作都由java部分实现和完成。每次必须更改某些gui属性或重新绘制gui时,都是通过jni调用JVM来完成的
以JVM/java能够处理的速度重新绘制(或刷新)完整的显示/gui。它以迭代的方式频繁地进行,每秒只有几百次或数千次迭代
经过一段精确的时间后,应用程序被exit(1)
终止,我用gdb捕捉到它,从_XIOError()
调用它。这种终止可以在大致准确的时间段后重复,例如在x86双核2.5GHz上约15小时后。如果我使用速度较慢的计算机,它会持续更长时间,就像它与cpu/gpu速度成正比一样。一些结论可能是xorg的某些部分耗尽了某些资源或类似的东西
这是我的回溯:
#0 0xb7fe1424 in __kernel_vsyscall ()
#1 0xb7c50941 in raise () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
#2 0xb7c53d72 in abort () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
#3 0xb7fdc69d in exit () from /temp/bin/liboverrides.so
#4 0xa0005c80 in _XIOError () from /usr/lib/i386-linux-gnu/libX11.so.6
#5 0xa0003afe in _XReply () from /usr/lib/i386-linux-gnu/libX11.so.6
#6 0x9fffee7b in XSync () from /usr/lib/i386-linux-gnu/libX11.so.6
#7 0xa01232b8 in X11SD_GetSharedImage () from /usr/lib/jvm/jre1.8.0_20/lib/i386/libawt_xawt.so
#8 0xa012529e in X11SD_GetRasInfo () from /usr/lib/jvm/jre1.8.0_20/lib/i386/libawt_xawt.so
#9 0xa01aac3d in Java_sun_java2d_loops_ScaledBlit_Scale () from /usr/lib/jvm/jre1.8.0_20/lib/i386/libawt.so
我打了自己的电话。因此,在abort()
/SIGABRT的帮助下,将其与LD_PRELOAD一起用于捕获gdb中的exit()
调用。
在对libX11和libxcb进行了一些调试之后,我注意到_XReply()
得到了NULL回复(来自xcb_wait_for_reply()
的响应),这导致调用_XIOError()
和exit(1)
。深入了解libxcb inxcb_wait_for_reply()
函数,我注意到它可以返回NULL reply的原因之一是当它检测到断开或关闭的socket连接时,这可能是我的情况
出于测试目的,如果我更改xcb_io。c和ignore _XIOError()
,应用程序不再工作。如果我在_XReply()
内重复请求,它每次都会失败,即在每个xcb_wait_for_reply()
上获得空响应
所以,我的问题是,为什么要用退出_XReply()
->XIOError()
->exit(1)
或者如何找出原因和发生的事情,以便修复它或进行一些变通
正如我在上面所写的,为了让这个问题再次出现,我必须等待大约15小时,但目前我调试的时间非常短,无法找到问题/终止的原因。 我们还尝试重新组织处理gui/显示刷新的java部分,但问题没有得到解决
一些事实:
-java jre 1.8.0_20,即使使用java 7,也会重复这个问题
-libX11。所以1.5.0
-libxcb。所以1.8.1
-debian哮喘病
-内核3.2.0
# 1 楼答案
这可能是libX11中关于处理用于xcb_wait_for_reply的请求号的已知问题
在libxcb v1之后的某个时刻。5.引入了在任何地方内部使用64位序列号的代码,并添加了逻辑,以便在进入仍然使用32位序列号的公共API时扩大序列号
以下是submitted libxcb bug report(实际删除的电子邮件)的引用:
重现问题
以下是提交的错误报告中用于重现问题的原始代码片段:
显然,这个问题可以用更简单的代码重现:
根据提交的libxcb bug报告,复制需要这些条件(假设复制代码在xdraw.c中):
建议的补丁
可应用于libxcb 1.8.1之上的建议补丁如下:
详细的技术说明
Plase find bellow包含detailed technical explanation by Jonas Petersen(也包含在上述错误报告中):
祝你好运