ubuntu环境下vlcj报错:A fatal error has been detected #C [libc.so.6+0x121024] _IO_file_underflow+0x64

最近采用vlcj进行播放软件的开发过程中遇到了一些问题,记录下来以做参考。
开发环境:windows10+eclipse Mars.2 Release (4.5.2)+jdk1.7.0_79
贴上官方示例代码

package tutorial;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.discovery.NativeDiscovery;

public class Tutorial {

    private final JFrame frame;

    private final EmbeddedMediaPlayerComponent mediaPlayerComponent;

    public static void main(final String[] args) {
        //new NativeDiscovery().discover();
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Tutorial();
            }
        });
    }


    public Tutorial() {
        frame = new JFrame("My First Media Player");
        frame.setBounds(100, 100, 600, 400);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
        frame.setContentPane(mediaPlayerComponent);
        frame.setVisible(true);
        mediaPlayerComponent.getMediaPlayer().playMedia("test.mp4");
    }
}

在Window平台下编译、运行正常。

运行平台:
ubuntu12.04(32bit)+vlc2.0.8+jre7
ubuntu14.04(32bit)+2.1.6+jre7
ubuntu16.04(32bit)+vlc2.2.2+jre7
以上三个平台环境下,当执行到playMedia()方法时,程序报错退出。也就是说,之前的界面渲染和构造对象都是没有影响的。
报错如下:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb76f3ec8, pid=15121, tid=0xa0817b40
#
# JRE version: Java(TM) SE Runtime Environment (8.0_144-b01) (build 1.8.0_144-b01)
# Java VM: Java HotSpot(TM) Client VM (25.144-b01 mixed mode linux-x86 )
# Problematic frame:
# C  [libc.so.6+0x127ec8]  _IO_file_underflow+0x68
#
# Core dump written. Default location: /home/linaro/Desktop/exe-test/core or core.15121
#
# An error report file with more information is saved as:
# /home/linaro/Desktop/exe-test/hs_err_pid15121.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp

参考网上一些资料后,比较有代表性的摘写如下
一哥们查看了gdb信息:

#0 0x0028f688 in _IO_file_underflow () from /lib/i386-linux-gnu/libc.so.6
#1 0x001d83a9 in _IO_default_uflow () from /lib/i386-linux-gnu/libc.so.6
#2 0x001d81c0 in __uflow () from /lib/i386-linux-gnu/libc.so.6
#3 0x001ce6d2 in getc () from /lib/i386-linux-gnu/libc.so.6
#4 0x02c8abc4 in luaL_loadfile () from /usr/lib/i386-linux-gnu/liblua5.1.so.0

他分析是在lauxlib.c文件的luaL_loadfile方法执行时出现的错误。

The piece of code that triggers this bug is in lauxlib.c in the luaL_loadfile method:

while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ; <— Crash failure triggered here after freopen

This bug is only triggered when the LUA script being opened has been compiled by luac - if I run the same test with a source script rather than a compiled script the fatal crash is not triggered. I think the lua code essentially opens the script file, sniffs for a magic number to check if it is a binary script, and if so reopens the file. I think it is this act of reopening the file that ultimately triggers the bug.

大概意思就是,这是个在特殊系统环境下才会产生的bug。当正在被打开的Lua脚本已经被luac编译过的时候,该bug才会被触发。
他认为这是Ubuntu自身的bug而不是JVM或是lua的问题,因为当他删掉Ubuntu提供的Lua包,换上自己的lua环境后,在32位的Ubuntu下就可以运行了。

I am reporting this as an Ubuntu bug rather than a JVM or lua bug because if I remove the lua package provided by Ubuntu and instead build lua myself using the vanilla untouched 5.1 source code from lua.org, my test case does in fact work on 32-bit Ubuntu.

同时他指出,仅32位操作系统受此影响,64位的Ubuntu是可以正常运行的。

参考了几处解决方案后,方法有3种:(1)换用64位的操作系统,(2)换用jre6;(3)将32位系统vlc下的lua文件夹移除。建议使用mv将其移除目录即可。

sudo mv /usr/lib/vlc/lua /usr/lib/lua-vlc-backup

大概是ubuntu的一个bug,精力有限,没有去细扣其中原委。以后有时间将加以补充。

参考出处:
https://github.com/caprica/vlcj/issues/62
https://bugs.launchpad.net/ubuntu/+source/lua5.1/+bug/1136432

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值