caprica / vlcj

Java framework for the vlc media player
http://www.capricasoftware.co.uk/projects/vlcj
1.13k stars 259 forks source link

An error when trying to open a video file on 32 bit Ubuntu #62

Closed ghost closed 12 years ago

ghost commented 12 years ago

Hello, my name is Lee, studying Computer Science in South Korea and trying to use vlcj project for some reason. After conducting many tests and searching Google hours, I figured out this problem has never happened to others. I need to run vlcj in both Windows and Ubuntu. I have no problem running it in Windows while in Ubuntu it always terminates with a SIGSEGV error. The exact moment programs terminate is right after I open a video file with a provided example, TestPlayer(in package uk.co.caprica.vlcj.test.basic) (Of course, the TestPlayer with the video file worked completely fine in Windows) I've tried to run the TestPlayer in both command-line and eclipse with as many combination of the following Ubuntu, vlc, and vlcj versions as possible. I even tried some on my friend's laptop and ended up in the same situation.

Details of my tests and a log file are as in the following OS Ubuntu 10.04 (Linux 2.6.32-21-generic) in VMWare Ubuntu 12.04 (linux 3.2.0-23-generic-pae) in VMWare and in direct installation JDK 1.7.0_05 Eclipse Juno 20120614-1722 Path to the vlc libraries /home/prosopher/vlc/lib (I gave it when I typed configure command) vlc version 1.1.10 / 2.0.2 (I mannually installed these in the above path) vlcj version 1.1.5 / 1.2.2 / 2.1.0

I tried every combination of the above Ubuntu, vlc, and vlcs versions. In command-line I typed the following line. java –jar –Djna.library.path=”/home/prosopher/vlc/lib” vlcj-1.1.5-test.jar In eclipse I gave the VM arguments –Djna.library.path.

Let me know if you need more information or don’t understand anything in my writing. Sincerely,

caprica commented 12 years ago

Forget about vlc 1.1.x and vlcj 1.1.x. You should always use the latest version. I see you say already that you tried that, so...

Start your application with -Dvlcj.log=DEBUG and post the log file.

I only develop vlcj on Linux (64bit Ubuntu 12.04), and I test both JDK 1.6 and 1.7 so I know for a fact it works properly if your environment is set up correctly.

Maybe there's some problem with running vlc under VMWare. Does the vlc application itself play videos on your platform?

ghost commented 12 years ago

Thanks for your fast support.

This time, I used 32bit Ubuntu 12.04 installed separately from Windows not in VMWare, used vlc 2.0.2, and vlcj which I just cloned from this github.

The independent vlc application itself plays video without any problem.

Anyway, this is the result with the DEBUG option.

       _       _
__   _| | ___ (_)
\ \ / / |/ __|| |
 \ V /| | (__ | |
  \_/ |_|\___|/ | 2.2.0
            |__/  www.capricasoftware.co.uk

VLCJ is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

VLCJ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with VLCJ.  If not, see <http://www.gnu.org/licenses/>.

Copyright 2009, 2010, 2011, 2012 Caprica Software Limited.

vlcj: (Info.java:103)                                | INFO  | vlcj: <version not available>
vlcj: (Info.java:104)                                | INFO  | java: 1.7.0_05 Oracle Corporation
vlcj: (Info.java:105)                                | INFO  | java home: /usr/lib/jvm/jdk1.7.0_05/jre
vlcj: (Info.java:106)                                | INFO  | os: Linux 3.2.0-26-generic-pae i386
vlcj: (LibVlcFactory.java:164)                       | INFO  | vlc: 2.0.2 Twoflower, changeset 2.0.1-453-g40d9fef
vlcj: (LibVlcFactory.java:165)                       | INFO  | libvlc: /home/prosopher/vlc/lib/libvlc.so
vlcj: (TestPlayer.java:102)                          | INFO  |   version: 2.0.2 Twoflower
vlcj: (TestPlayer.java:103)                          | INFO  |  compiler: gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
vlcj: (TestPlayer.java:104)                          | INFO  | changeset: 2.0.1-453-g40d9fef
vlcj: (TestPlayer.java:125)                          | DEBUG | videoSurface=java.awt.Canvas[canvas0,0,0,0x0,invalid]
vlcj: (TestPlayer.java:161)                          | DEBUG | vlcArgs=[--no-plugins-cache, --no-video-title-show, --no-snapshot-preview, --quiet, --quiet-synchro, --intf, dummy]
vlcj: (DefaultFullScreenStrategy.java:57)            | DEBUG | DefaultFullScreenStrategy(window=javax.swing.JFrame[frame0,65,24,0x0,invalid,hidden,layout=java.awt.BorderLayout,title=VLCJ Test Player,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,0,0x0,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.synth.SynthBorder@867009,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true])
vlcj: (LibVlcFactory.java:164)                       | INFO  | vlc: 2.0.2 Twoflower, changeset 2.0.1-453-g40d9fef
vlcj: (LibVlcFactory.java:165)                       | INFO  | libvlc: /home/prosopher/vlc/lib/libvlc.so
vlcj: (MediaPlayerFactory.java:188)                  | DEBUG | MediaPlayerFactory(libvlc=Proxy interface to Native Library </home/prosopher/vlc/lib/libvlc.so@2132712136>,libvlcArgs=[--no-plugins-cache, --no-video-title-show, --no-snapshot-preview, --quiet, --quiet-synchro, --intf, dummy])
vlcj: (MediaPlayerFactory.java:190)                  | DEBUG | jna.library.path=/home/prosopher/vlc/lib
vlcj: (MediaPlayerFactory.java:213)                  | DEBUG | instance=native@0x7f72aaa8
vlcj: (MediaPlayerFactory.java:269)                  | DEBUG | setUserAgent(userAgent=vlcj test player)
vlcj: (MediaPlayerFactory.java:280)                  | DEBUG | setUserAgent(userAgent=vlcj test player,httpUserAgent=null)
vlcj: (MediaPlayerFactory.java:293)                  | DEBUG | getAudioOutputs()
vlcj: (MediaPlayerFactory.java:314)                  | DEBUG | getAudioOutputDevices(outputName=aout_file)
vlcj: (MediaPlayerFactory.java:316)                  | DEBUG | deviceCount=0
vlcj: (MediaPlayerFactory.java:314)                  | DEBUG | getAudioOutputDevices(outputName=amem)
vlcj: (MediaPlayerFactory.java:316)                  | DEBUG | deviceCount=0
vlcj: (MediaPlayerFactory.java:314)                  | DEBUG | getAudioOutputDevices(outputName=pulse)
vlcj: (MediaPlayerFactory.java:316)                  | DEBUG | deviceCount=0
vlcj: (MediaPlayerFactory.java:314)                  | DEBUG | getAudioOutputDevices(outputName=jack)
vlcj: (MediaPlayerFactory.java:316)                  | DEBUG | deviceCount=0
vlcj: (MediaPlayerFactory.java:314)                  | DEBUG | getAudioOutputDevices(outputName=alsa)
vlcj: (MediaPlayerFactory.java:316)                  | DEBUG | deviceCount=18
vlcj: (MediaPlayerFactory.java:314)                  | DEBUG | getAudioOutputDevices(outputName=adummy)
vlcj: (MediaPlayerFactory.java:316)                  | DEBUG | deviceCount=0
vlcj: (TestPlayer.java:172)                          | DEBUG | audioOutputs=[AudioOutput[name=aout_file,description=File audio output,devices=[]], AudioOutput[name=amem,description=Audio memory output,devices=[]], AudioOutput[name=pulse,description=Pulseaudio audio output,devices=[]], AudioOutput[name=jack,description=JACK audio output,devices=[]], AudioOutput[name=alsa,description=ALSA audio output,devices=[AudioDevice[deviceId=default,longName=Default], AudioDevice[deviceId=default,longName=Playback/recording through the PulseAudio sound server], AudioDevice[deviceId=sysdefault:CARD=Intel,longName=HDA Intel, CONEXANT Analog Default Audio Device], AudioDevice[deviceId=front:CARD=Intel,DEV=0,longName=HDA Intel, CONEXANT Analog Front speakers], AudioDevice[deviceId=surround40:CARD=Intel,DEV=0,longName=HDA Intel, CONEXANT Analog 4.0 Surround output to Front and Rear speakers], AudioDevice[deviceId=surround41:CARD=Intel,DEV=0,longName=HDA Intel, CONEXANT Analog 4.1 Surround output to Front, Rear and Subwoofer speakers], AudioDevice[deviceId=surround50:CARD=Intel,DEV=0,longName=HDA Intel, CONEXANT Analog 5.0 Surround output to Front, Center and Rear speakers], AudioDevice[deviceId=surround51:CARD=Intel,DEV=0,longName=HDA Intel, CONEXANT Analog 5.1 Surround output to Front, Center, Rear and Subwoofer speakers], AudioDevice[deviceId=surround71:CARD=Intel,DEV=0,longName=HDA Intel, CONEXANT Analog 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers], AudioDevice[deviceId=hdmi:CARD=Intel,DEV=0,longName=HDA Intel, HDMI 0 HDMI Audio Output], AudioDevice[deviceId=dmix:CARD=Intel,DEV=0,longName=HDA Intel, CONEXANT Analog Direct sample mixing device], AudioDevice[deviceId=dmix:CARD=Intel,DEV=3,longName=HDA Intel, HDMI 0 Direct sample mixing device], AudioDevice[deviceId=dsnoop:CARD=Intel,DEV=0,longName=HDA Intel, CONEXANT Analog Direct sample snooping device], AudioDevice[deviceId=dsnoop:CARD=Intel,DEV=3,longName=HDA Intel, HDMI 0 Direct sample snooping device], AudioDevice[deviceId=hw:CARD=Intel,DEV=0,longName=HDA Intel, CONEXANT Analog Direct hardware device without any conversions], AudioDevice[deviceId=hw:CARD=Intel,DEV=3,longName=HDA Intel, HDMI 0 Direct hardware device without any conversions], AudioDevice[deviceId=plughw:CARD=Intel,DEV=0,longName=HDA Intel, CONEXANT Analog Hardware device with all software conversions], AudioDevice[deviceId=plughw:CARD=Intel,DEV=3,longName=HDA Intel, HDMI 0 Hardware device with all software conversions]]], AudioOutput[name=adummy,description=Dummy audio output,devices=[]]]
vlcj: (MediaPlayerFactory.java:405)                  | DEBUG | newEmbeddedMediaPlayer(fullScreenStrategy=uk.co.caprica.vlcj.player.embedded.DefaultFullScreenStrategy@baa0)
vlcj: (DefaultMediaPlayer.java:169)                  | DEBUG | DefaultMediaPlayer(libvlc=Proxy interface to Native Library </home/prosopher/vlc/lib/libvlc.so@2132712136>, instance=native@0x7f72aaa8)
vlcj: (DefaultMediaPlayer.java:1486)                 | DEBUG | createInstance()
vlcj: (DefaultMediaPlayer.java:1489)                 | DEBUG | mediaPlayerInstance=native@0x7c957da8
vlcj: (DefaultMediaPlayer.java:1492)                 | DEBUG | mediaPlayerEventManager=native@0x7c95a098
vlcj: (DefaultMediaPlayer.java:1539)                 | DEBUG | registerEventListener()
vlcj: (MediaPlayerFactory.java:474)                  | DEBUG | newVideoSurface(canvas=java.awt.Canvas[canvas0,0,0,800x600,invalid])
vlcj: (MediaPlayerFactory.java:489)                  | DEBUG | videoSurface=uk.co.caprica.vlcj.player.embedded.videosurface.CanvasVideoSurface@1eb7fdd
vlcj: (DefaultEmbeddedMediaPlayer.java:142)          | DEBUG | setVideoSurface(videoSurface=uk.co.caprica.vlcj.player.embedded.videosurface.CanvasVideoSurface@1eb7fdd)
vlcj: (DefaultMediaPlayer.java:323)                  | DEBUG | setPlaySubItems(playSubItems=true)
vlcj: (DefaultEmbeddedMediaPlayer.java:274)          | DEBUG | setEnableKeyInputHandling(enable=false)
vlcj: (DefaultEmbeddedMediaPlayer.java:268)          | DEBUG | setEnableMouseInputHandling(enable=false)
vlcj: (DefaultMediaPlayer.java:175)                  | DEBUG | addMediaPlayerEventListener(listener=uk.co.caprica.vlcj.test.basic.PlayerControlsPanel$1@168f2ef)
vlcj: (DefaultMediaPlayer.java:1377)                 | DEBUG | getBrightness()
vlcj: (DefaultMediaPlayer.java:1365)                 | DEBUG | getContrast()
vlcj: (DefaultMediaPlayer.java:1389)                 | DEBUG | getHue()
vlcj: (DefaultMediaPlayer.java:1401)                 | DEBUG | getSaturation()
vlcj: (DefaultMediaPlayer.java:1413)                 | DEBUG | getGamma()
vlcj: (DefaultMediaPlayer.java:175)                  | DEBUG | addMediaPlayerEventListener(listener=uk.co.caprica.vlcj.test.basic.TestPlayer$TestPlayerMediaPlayerEventListener@2d962c)
vlcj: (TestPlayer.java:281)                          | DEBUG | transparentWindowsSupport=true
vlcj: (TestPlayer.java:556)                          | DEBUG | mouseEntered(e=java.awt.event.MouseEvent[MOUSE_ENTERED,(422,84),absolute(493,184),button=0,clickCount=0] on canvas0)
vlcj: (TestPlayer.java:561)                          | DEBUG | mouseExited(e=java.awt.event.MouseEvent[MOUSE_EXITED,(422,84),absolute(493,184),button=0,clickCount=0] on canvas0)
vlcj: (TestPlayer.java:556)                          | DEBUG | mouseEntered(e=java.awt.event.MouseEvent[MOUSE_ENTERED,(422,84),absolute(493,184),button=0,clickCount=0] on canvas0)
vlcj: (TestPlayer.java:561)                          | DEBUG | mouseExited(e=java.awt.event.MouseEvent[MOUSE_EXITED,(683,600),absolute(749,675),button=0,clickCount=0] on canvas0)
vlcj: (DefaultEmbeddedMediaPlayer.java:238)          | DEBUG | enableOverlay(enable=false)
vlcj: (DefaultMediaPlayer.java:201)                  | DEBUG | playMedia(mrl=/home/prosopher/test.avi,mediaOptions=[])
vlcj: (DefaultMediaPlayer.java:215)                  | DEBUG | prepareMedia(mrl=/home/prosopher/test.avi,mediaOptions=[])
vlcj: (DefaultMediaPlayer.java:1624)                 | DEBUG | setMedia(media=/home/prosopher/test.avi,mediaOptions=[])
vlcj: (DefaultMediaPlayer.java:1637)                 | DEBUG | mediaInstance=native@0x7c8c7290
vlcj: (DefaultMediaPlayer.java:1571)                 | DEBUG | registerMediaEventListener()
vlcj: (DefaultMediaPlayer.java:1438)                 | DEBUG | mrl(mediaInstance=native@0x7c8c7290)
vlcj: (TestPlayer.java:385)                          | DEBUG | mediaChanged(mediaPlayer=uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer@701425,media=native@0x7c8c7290,mrl=file:///home/prosopher/test.avi)
vlcj: (DefaultMediaPlayer.java:666)                  | DEBUG | play()
vlcj: (DefaultEmbeddedMediaPlayer.java:314)          | DEBUG | onBeforePlay()
vlcj: (DefaultEmbeddedMediaPlayer.java:151)          | DEBUG | attachVideoSurface()
vlcj: (DefaultMediaPlayer.java:1782)                 | DEBUG | mediaChanged(mediaPlayer=uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer@701425,media=native@0x7c8c7290,mrl=file:///home/prosopher/test.avi)
vlcj: (DefaultMediaPlayer.java:1786)                 | DEBUG | Raising event for new media
vlcj: (CanvasVideoSurface.java:67)                   | DEBUG | attach()
vlcj: (LinuxVideoSurfaceAdapter.java:39)             | DEBUG | attach(componentId=71303185)
vlcj: (TestPlayer.java:509)                          | DEBUG | mediaMetaChanged(mediaPlayer=uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer@701425,metaType=12)
vlcj: (TestPlayer.java:509)                          | DEBUG | mediaMetaChanged(mediaPlayer=uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer@701425,metaType=15)
vlcj: (DefaultEmbeddedMediaPlayer.java:238)          | DEBUG | enableOverlay(enable=true)
vlcj: (TestPlayer.java:504)                          | DEBUG | mediaStateChanged(mediaPlayer=uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer@701425,newState=1)
vlcj: (TestPlayer.java:509)                          | DEBUG | mediaMetaChanged(mediaPlayer=uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer@701425,metaType=12)
vlcj: (TestPlayer.java:509)                          | DEBUG | mediaMetaChanged(mediaPlayer=uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer@701425,metaType=13)
vlcj: (TestPlayer.java:509)                          | DEBUG | mediaMetaChanged(mediaPlayer=uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer@701425,metaType=15)
vlcj: (TestPlayer.java:489)                          | DEBUG | mediaDurationChanged(mediaPlayer=uk.co.caprica.vlcj.player.embedded.DefaultEmbeddedMediaPlayer@701425,newDuration=204000)
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb767c688, pid=4407, tid=2080172864
#
# JRE version: 7.0_05-b05
# Java VM: Java HotSpot(TM) Server VM (23.1-b03 mixed mode linux-x86 )
# Problematic frame:
# C  [libc.so.6+0x128688]  _IO_file_underflow+0x68
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/prosopher/workspace/vlcj/hs_err_pid4407.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
caprica commented 12 years ago

Is it just one video file that fails? Does it fail with an audio only file?

What do you mean "installed separately from Windows" - I thought your problem was on Ubuntu?

Anyway, I noticed this: vlcj: (Info.java:105) | INFO | java home: /usr/lib/jvm/jdk1.7.0_05/jre

Instead of that JRE, I would suggest you install a JDK into e.g. ~/jdk1.7.0_15, and invoke your application explicitly using that version of the JDK, e,g, ~/jdk1.7.0_15/bin/java [whatever]. At least try it and see if that makes any difference. Also try JDK 1.6, just to narrow down the problem a bit.

The segfault is in native code somewhere, specifically in libc. So the only other thing I can think of is that you use gdb to debug the JVM, catch the breakpoint and dump out a full thread-dump.

I'm afraid I have nothing else to add, this works for me, and I've never had any other report of it failing for anyone else.

ghost commented 12 years ago

So far, it hasn't failed with an audio only file.

I wanted to say Ubuntu was installed independently, not in VMWare.

I tried it with jdk1.7.0_05 with a new path(~/jdk.1.7.0_05) and an explicit invocation, but it failed with the same error.

I used jdk1.6.0_33 and it worked!!

I didn't change anything but just jdk as you suggested.

I'm not a c programmer, so I don't think I could debug this big project.

ghost commented 12 years ago

Hi, this is Lee again.

I said that before to mean I have no idea how to dump out a full thread-dump.

But I'm willing to find out a way if I really have to.

Anyway, I have done a couple more of tests to narrow down and want your advice one more time.

With Ubuntu 12.04 64 bit and JDK 1.7.0_05, it worked for me as well. With Ubuntu 12.04 32 bit and JDK 1.6.0_33, it worked. With Ubuntu 12.04 32 bit and JDK 1.7.0_05, it failed. With Windows 7 Ultimate K 32 bit and JDK 1.7.0_05, it worked.

As you mentioned, I used the latest versions of vlc and vlcj.

It seems to me that it only crashes when JDK 1.7.0_05 is applied to Ubuntu 32 bit.

I'm not trying to avoid your suggestion.

I just want to know what I need to do to make vlcj work in 32 bit.

Do you still think I need to debug JVM with gdb?

caprica commented 12 years ago

Well, I dug out an old laptop and put 32-bit Xubuntu 12.04 on it.

I get a segfault when i play a video.

So, I can now reproduce your problem. Basically the libvlc_media_player_play call is ultimately triggering a segfault for some reason.

caprica commented 12 years ago

I can also confirm on that platform that JDK 1.6.0_33 works, same as you.

I could be somehow related to changes in the Java loader in JDK 1.7 as discussed here:

http://www.capricasoftware.co.uk/wiki/index.php?title=Vlcj_Java7_On_Linux

Unfortunately, the suggestions on that page don't help.

ghost commented 12 years ago

I'm glad you confirmed my problem too.

The suggestions didn't help me either.

Actually I've decided to exclude 32 bit Ubuntu for now because I have other priorities.

I hope this problem is solved soon.

Thank you for taking your time.

caprica commented 12 years ago

The problem seems quite fundamental.

I can actually eliminate vlcj from this and just use the raw bindings to demonstrate this failure under 32bit Ubuntu:

import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.binding.internal.libvlc_instance_t;
import uk.co.caprica.vlcj.binding.internal.libvlc_media_player_t;
import uk.co.caprica.vlcj.binding.internal.libvlc_media_t;

public class BareBones {

    public static void main(String[] args) throws Exception {
        LibVlc libvlc = LibVlc.INSTANCE;

        libvlc_instance_t instance = libvlc.libvlc_new(args.length, args);
        libvlc_media_player_t mediaPlayer = libvlc.libvlc_media_player_new(instance);
        libvlc_media_t media = libvlc.libvlc_media_new_path(instance, "/big/movies/whatever.iso");
        libvlc.libvlc_media_player_set_media(mediaPlayer, media);
        libvlc.libvlc_media_player_play(mediaPlayer);

        Thread.sleep(10000);

        libvlc.libvlc_media_player_stop(mediaPlayer);
        libvlc.libvlc_media_player_release(mediaPlayer);
        libvlc.libvlc_release(instance);

        System.exit(0);
    }
}

The above class is basically using NO vlcj framework classes - it simply uses the "raw" bindings in the LibVlc native interface.

This class causes the same fatal crash when invoking play().

This class works on JDK 1.6.0.

This class works on 64 bit Ubuntu.

I suspect it will also work on the same platforms you tried, with the exception of 32 bit Ubuntu.

So whatever this problem is, it is not caused by a higher level vlcj framework class, it is something fundamental going wrong on Java7 on a 32bit Linux platform.

caprica commented 12 years ago

And here is a native thread dump when it crashes:

Thread 12 (Thread 0xa157eb40 (LWP 2576)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013d96b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x01083543 in vlc_cond_wait () from /usr/lib/libvlccore.so.5
#3  0x01083e04 in ?? () from /usr/lib/libvlccore.so.5
#4  0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#5  0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 11 (Thread 0xa15ffb40 (LWP 2575)):
#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
#5  0x02c51f39 in ?? () from /usr/lib/vlc/plugins/lua/liblua_plugin.so
#6  0x02c52180 in ?? () from /usr/lib/vlc/plugins/lua/liblua_plugin.so
#7  0x02c55547 in ?? () from /usr/lib/vlc/plugins/lua/liblua_plugin.so
#8  0x02c523d6 in ?? () from /usr/lib/vlc/plugins/lua/liblua_plugin.so
#9  0x010633d0 in ?? () from /usr/lib/libvlccore.so.5
#10 0x01063a3a in vlc_module_load () from /usr/lib/libvlccore.so.5
#11 0x01064002 in module_need () from /usr/lib/libvlccore.so.5
#12 0x0101d275 in ?? () from /usr/lib/libvlccore.so.5
#13 0x0102062b in ?? () from /usr/lib/libvlccore.so.5
#14 0x01024acc in ?? () from /usr/lib/libvlccore.so.5
#15 0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#16 0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 10 (Thread 0xa19fdb40 (LWP 2574)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013d96b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x01083543 in vlc_cond_wait () from /usr/lib/libvlccore.so.5
#3  0x00ff68e1 in ?? () from /usr/lib/libvlccore.so.5
#4  0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#5  0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 9 (Thread 0xa1a7eb40 (LWP 2569)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013dd13 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x006b098a in os::PlatformEvent::park(long long) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#3  0x007654a1 in WatcherThread::run() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#4  0x006b1fc1 in java_start(Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#5  0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 8 (Thread 0xa1e5db40 (LWP 2568)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013d96b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x006ab9e1 in os::PlatformEvent::park() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#3  0x00689392 in Monitor::IWait(Thread*, long long) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#4  0x00689b80 in Monitor::wait(bool, long, bool) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#5  0x006f94fb in ServiceThread::service_thread_entry(JavaThread*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#6  0x00768a94 in JavaThread::thread_main_inner() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#7  0x00768c21 in JavaThread::run() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#8  0x006b1fc1 in java_start(Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#9  0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#10 0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 7 (Thread 0xa1affb40 (LWP 2567)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013d96b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x006ab9e1 in os::PlatformEvent::park() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#3  0x00689392 in Monitor::IWait(Thread*, long long) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#4  0x00689c04 in Monitor::wait(bool, long, bool) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#5  0x00490ec7 in CompileQueue::get() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#6  0x00493f87 in CompileBroker::compiler_thread_loop() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#7  0x00761f08 in compiler_thread_entry(JavaThread*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#8  0x00768a94 in JavaThread::thread_main_inner() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#9  0x00768c21 in JavaThread::run() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#10 0x006b1fc1 in java_start(Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#11 0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#12 0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 6 (Thread 0xa1eaeb40 (LWP 2566)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013fcc5 in sem_wait@@GLIBC_2.1 () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x006b0562 in check_pending_signals(bool) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#3  0x006aa082 in signal_thread_entry(JavaThread*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#4  0x00768a94 in JavaThread::thread_main_inner() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#5  0x00768c21 in JavaThread::run() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#6  0x006b1fc1 in java_start(Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#7  0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#8  0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 5 (Thread 0xa1effb40 (LWP 2565)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013d96b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x006ab9e1 in os::PlatformEvent::park() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#3  0x006a25f3 in ObjectMonitor::wait(long long, bool, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#4  0x007338f3 in ObjectSynchronizer::wait(Handle, long long, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#5  0x005e40d7 in JVM_MonitorWait () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#6  0xb5e0a84d in ?? ()
#7  0xb5e032c7 in ?? ()
#8  0xb5e0345a in ?? ()
#9  0xb5e0345a in ?? ()
#10 0xb5e003d9 in ?? ()
#11 0x00586b75 in JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) ()
   from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#12 0x006ab459 in os::os_exception_wrapper(void (*)(JavaValue*, methodHandle*, JavaCallArguments*, Thread*), JavaValue*, methodHandle*, JavaCallArguments*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#13 0x0058598f in JavaCalls::call(JavaValue*, methodHandle, JavaCallArguments*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#14 0x00586d22 in JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*) ()
   from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#15 0x005d1259 in thread_entry(JavaThread*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#16 0x00768a94 in JavaThread::thread_main_inner() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#17 0x00768c21 in JavaThread::run() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#18 0x006b1fc1 in java_start(Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#19 0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#20 0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 4 (Thread 0xa2060b40 (LWP 2564)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013d96b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x006ab9e1 in os::PlatformEvent::park() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#3  0x006a25f3 in ObjectMonitor::wait(long long, bool, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#4  0x007338f3 in ObjectSynchronizer::wait(Handle, long long, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#5  0x005e40d7 in JVM_MonitorWait () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#6  0xb5e0a84d in ?? ()
#7  0xb5e032c7 in ?? ()
#8  0xb5e032c7 in ?? ()
#9  0xb5e003d9 in ?? ()
#10 0x00586b75 in JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) ()
   from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#11 0x006ab459 in os::os_exception_wrapper(void (*)(JavaValue*, methodHandle*, JavaCallArguments*, Thread*), JavaValue*, methodHandle*, JavaCallArguments*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#12 0x0058598f in JavaCalls::call(JavaValue*, methodHandle, JavaCallArguments*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#13 0x00586d22 in JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*) ()
   from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#14 0x005d1259 in thread_entry(JavaThread*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#15 0x00768a94 in JavaThread::thread_main_inner() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#16 0x00768c21 in JavaThread::run() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#17 0x006b1fc1 in java_start(Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#18 0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#19 0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 3 (Thread 0xa20e1b40 (LWP 2563)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013dd13 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x006b098a in os::PlatformEvent::park(long long) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#3  0x0068966d in Monitor::IWait(Thread*, long long) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#4  0x00689b80 in Monitor::wait(bool, long, bool) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#5  0x007a14a3 in VMThread::loop() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#6  0x007a19f5 in VMThread::run() () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#7  0x006b1fc1 in java_start(Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#8  0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#9  0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 2 (Thread 0xb7fe3b40 (LWP 2562)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013dd13 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x006b098a in os::PlatformEvent::park(long long) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#3  0x006b1a32 in os::sleep(Thread*, long long, bool) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#4  0x005e3670 in JVM_Sleep () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#5  0xb5e0a84d in ?? ()
#6  0xb5e032c7 in ?? ()
#7  0xb5e003d9 in ?? ()
#8  0x00586b75 in JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) ()
   from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#9  0x006ab459 in os::os_exception_wrapper(void (*)(JavaValue*, methodHandle*, JavaCallArguments*, Thread*), JavaValue*, methodHandle*, JavaCallArguments*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#10 0x0058598f in JavaCalls::call(JavaValue*, methodHandle, JavaCallArguments*, Thread*) () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#11 0x005993ea in jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) ()
   from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#12 0x005a43fb in jni_CallStaticVoidMethod () from /home/java/jdk1.7.0_05/jre/lib/i386/client/libjvm.so
#13 0x00151354 in JavaMain () from /home/java/jdk1.7.0_05/bin/../jre/lib/i386/jli/libjli.so
#14 0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#15 0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 1 (Thread 0xb7fe46c0 (LWP 2559)):
#0  0x00132416 in __kernel_vsyscall ()
#1  0x0013ae1c in pthread_join () from /lib/i386-linux-gnu/libpthread.so.0
#2  0x0015b40a in ContinueInNewThread0 () from /home/java/jdk1.7.0_05/bin/../jre/lib/i386/jli/libjli.so
#3  0x0014faf6 in ContinueInNewThread () from /home/java/jdk1.7.0_05/bin/../jre/lib/i386/jli/libjli.so
#4  0x0015b2db in JVMInit () from /home/java/jdk1.7.0_05/bin/../jre/lib/i386/jli/libjli.so
#5  0x001528d5 in JLI_Launch () from /home/java/jdk1.7.0_05/bin/../jre/lib/i386/jli/libjli.so
#6  0x0804859d in main ()
caprica commented 12 years ago

Debugging native issues like this usually leads you up and down a few garden paths, however this time we're right on the money...

The thing that stands out about this native thread dump for the failing thread is this:

Thread 11 (Thread 0xa15ffb40 (LWP 2575)):
#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
#5  0x02c51f39 in ?? () from /usr/lib/vlc/plugins/lua/liblua_plugin.so

So my first inclination is to somehow disable LUA and see what happens.

And indeed, if you move the vlc lua plugin out of the way, video playback works.

The downside is you lose the lua support, which means things like YouTube won't work.

So I guess there's some problem with vlc 2.0.x and the lua library on Java1.7 on 32-bit Ubuntu 12.04 (lua is version 5.04 on my Xubuntu installation).

caprica commented 12 years ago

I also built vlc 2.0.x latest from git, and it still fails as described above on 32-bit Ubuntu.

The only solution right now for (vlcj + Java7 + 32-bit Ubuntu) is to disable/remove lua from vlc.

caprica commented 12 years ago

This also seems pertinent:

#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  0x014e9bc4 in luaL_loadfile () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#5  0x014b5a8a in run (p_this=0xa1d04d98, psz_filename=0xa1d1f5d0 "/home/linux/vlc/install/lib/vlc/lua/meta/reader/filename.luac", L=0xa1d1f618, 
    luafunction=0x14c9329 "read_meta") at meta.c:103
#6  0x014b5cd0 in read_meta (p_this=0xa1d04d98, psz_filename=0xa1d1f5d0 "/home/linux/vlc/install/lib/vlc/lua/meta/reader/filename.luac", 
    user_data=0xa1653130) at meta.c:195
#7  0x014b8ede in vlclua_scripts_batch_execute (p_this=0xa1d04d98, luadirname=0x14c936e "meta/reader", func=0x14b5c80 <read_meta>, user_data=0xa1653130)
    at vlc.c:301
#8  0x014b5f36 in ReadMeta (p_this=0xa1d04d98) at meta.c:230
#9  0x0104f8b0 in generic_start (func=0x14b5f00, ap=0xa19fd188 "\250џ\241\364\317\n\001\001") at modules/modules.c:413
#10 0x0104fd3a in vlc_module_load (p_this=0xa1d04d98, psz_capability=0x1086c84 "meta reader", psz_name=<optimized out>, b_strict=false, 
    probe=0x104f8a0 <generic_start>) at modules/modules.c:342
#11 0x01050182 in module_need (obj=0xa1d04d98, cap=0x1086c84 "meta reader", name=0x0, strict=false) at modules/modules.c:428
#12 0x01018697 in InputSourceMeta (p_input=0xa1653350, p_meta=0xa1d190d8, p_source=<optimized out>) at input/input.c:2732
#13 0x0101b67e in Init (p_input=0xa1653350) at input/input.c:1294
#14 0x0101f7b0 in Run (obj=0xa1653350) at input/input.c:539
#15 0x00139d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#16 0x00251ace in clone () from /lib/i386-linux-gnu/libc.so.6

So something is wrong with executing lua scripts generally, or this particular script is causing the problem.

samuelmello commented 12 years ago

Is vlclua enabled/disabled globally or there is any way to disable it only for my vlcj application?

caprica commented 12 years ago

As far as I know, vlc lua is enabled/disabled at the source code level.

caprica commented 12 years ago

Further findings:

If you remove /lib/vlc/lua/meta/reader/filename.luac then it will work.

The 32-bit Linux I tested this on is an Ubuntu/Debian derivative with LUA 5.1. If you build and install LUA from the lua.org homepage, then this combination of java7+vlc+lua+Ubuntu32 will work.

If you look at the source of the LUA package for the Linux distribution, you will see various patches that have been applied - something here is causing the failure.

So something is wrong with the 32-but LUA distribution package on Ubuntu 32-bit, not LUA itself.

caprica commented 11 years ago

I spent some more time looking at this, since Ubuntu-32bit is a popular enough platform, and was hoping that the 12.10 release of Ubuntu would fix it.

I narrowed down the segfault a bit more by looking more inside the LUA code, specifically in the luaL_loadfile method inside the lauxlib.c source file:

LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {
  LoadF lf;
  int status, readstatus;
  int c;
  int fnameindex = lua_gettop(L) + 1;  /* index of filename on the stack */
  lf.extraline = 0;
  if (filename == NULL) {
    lua_pushliteral(L, "=stdin");
    lf.f = stdin;
  }
  else {
    lua_pushfstring(L, "@%s", filename);
    lf.f = fopen(filename, "r");
    if (lf.f == NULL) return errfile(L, "open", fnameindex);
  }
  c = getc(lf.f);
  if (c == '#') {  /* Unix exec. file? */
    lf.extraline = 1;
    while ((c = getc(lf.f)) != EOF && c != '\n') ;  /* skip first line */
    if (c == '\n') c = getc(lf.f);
  }
  if (c == LUA_SIGNATURE[0] && filename) {  /* binary file? */
    lf.f = freopen(filename, "rb", lf.f);  /* reopen in binary mode */
    if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
    /* skip eventual `#!...' */
    while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ; <--- CRASH FAILURE HERE

It actually fails on the FIRST getc() invocation inside the while loop... right after freopen is called a valid file handle (non-NULL) is returned, but the very first getc() invocation causes the IO_file_underflow segfault.

So, the same problem exists on 32-bit Ubuntu 12.10 - something in the Ubuntu/Debian LUA patches triggers this crash.

It still works just fine on Java6 on 32-bit Ubuntu, or on Java6 or Java7 on 64-bit Ubuntu, and it still works just fine with a standard LUA build rather than the Ubuntu/Debian patched LUA build.

caprica commented 11 years ago

Created a minimal test case using the "raw" bindings. This is 100% reproducible when running on Java7 on 32-bit Ubuntu. But it works fine on Java6 on all platforms, and on Java7 on 64-bit Ubuntu.

https://github.com/caprica/vlcj/blob/master/src/test/java/uk/co/caprica/vlcj/test/bare/BareBonesParseTest.java

caprica commented 11 years ago

See also http://forum.videolan.org/viewtopic.php?f=32&t=107553.

caprica commented 11 years ago

Also http://forum.videolan.org/viewtopic.php?f=32&t=99155.

caprica commented 11 years ago

Made a custom build of the latest OpenJdk7 on 32bit Ubuntu 12.10, making sure "_IO_stdin_used" was declared and exported - same fatal JVM crash ensues.

This flag was exported anyway as far I as can tell.

caprica commented 11 years ago

So I am still investigating this from time to time... I created a simple test class that embeds LUA directly inside a Java application by using the C API:

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import com.sun.jna.Pointer;

public class LuaTest {

    public interface LibLua extends Library {

        LibLua INSTANCE = (LibLua)Native.loadLibrary("lua5.1", LibLua.class);

        public static int LUA_MULTRET = -1;

        Pointer lua_open();
        Pointer luaL_newstate();
        void luaL_openlibs(Pointer instance);
        int luaL_loadfile(Pointer pointer, String filename);
        int lua_pcall(Pointer pointer, int nargs, int nresults, int errfunc);
        void lua_close(Pointer instance);
    };

    public static void main(String[] args) {
        NativeLibrary.addSearchPath("lua5.1", "/usr/lib/i386-linux-gnu");

        LibLua lua = LibLua.INSTANCE;

        Pointer instance = lua.luaL_newstate();

        lua.luaL_openlibs(instance);

        int loadFile = lua.luaL_loadfile(instance, "test.lua");
        System.out.println("loadFile: " + loadFile);

        int pcall = lua.lua_pcall(instance, 0, LibLua.LUA_MULTRET, 0);
        System.out.println("pcall: " + pcall);

        lua.lua_close(instance);
    }
}

In theory, the luaL_loadfile call should trigger the same crash bug when run under Java7 on 32-bit Ubuntu.

In actuality, it works just fine and does not trigger the crash bug.

What does it mean, is it relevant? I don't know.

The referenced "test.lua" is just a file in the current directory that does this:

    print ("Wibble")

See comment below, you need to first compile test.lua with the "luac" compiler, then use that compiled version rather than the source version.

caprica commented 11 years ago

If you compile the test.lua file and then try and execute that, the same crash bug IS indeed triggered.

This basically rules out vlc/libvlc as part of the problem.

caprica commented 11 years ago

https://bugs.launchpad.net/ubuntu/+source/lua5.1/+bug/1136432

fman028 commented 11 years ago

I have the same problem. You said disabling lua fixes the problem, but stops things like youtube from working. I'm trying to use vlcj to receive an rtsp stream, will that also stop working if I remove lua?

caprica commented 11 years ago

It depends.

If your RTSP stream is simply a URL that you go to directly, it will still work.

If it is in a playlist that needs to be parsed, or some web page that needs to be parsed to find the actual streaming URL, then of couse it won't work without LUA.

I would basically recommend you use Java6 on 32-bit Ubuntu and then the problem goes away.

fman028 commented 11 years ago

I see, awesome, I'll try out Java6. Thanks caprica!

Brilliant, that worked perfectly :)

caprica commented 11 years ago

I think I've exhausted what I can do on this issue.

If you want to see any action on it, perhaps vote on the Ubuntu bug I created in LaunchPad (see a few comments up).

caprica commented 11 years ago

This has some background information that may or may not be relevant:

http://debian.2.n7.nabble.com/Bug-634261-Debian-634261-Is-it-actually-a-n-RC-bug-td2832431.html

caprica commented 11 years ago

This is still broken in Ubuntu 13.04 beta.

konstantin66 commented 11 years ago

The same problem I had on Russian Fedora Remix 18 LINUX 32-bit and jdk 1.7.0_09. Disabling LUA fixes the problem as caprica suggested. For my application purpose, I don't need the LUA. Also, it is good point to try JDK 1.6_33, as some people did, probably it will work. Anyway, Russian Fedora Remix 18 seems to have the same problem as Ubuntu does

caprica commented 11 years ago

Interesting, thanks.

I really don't know what to do about this.

The latest comments on the Ubuntu LaunchPad bug report suggest that LUA is not the problem, rather it is some sort of shared library pre-load artefact. It could be that the JVM is at fault, but how to track it down and fix it I have no idea.

hanzou commented 11 years ago

rm /usr/lib/vlc/lua/ -r this solved this issue ;)

caprica commented 11 years ago

Yes, and that will work for most use cases just fine, but some potentially useful things are no longer available - like YouTube. Personally for my own projects I couldn't care less about playing YouTube videos, but some users need it.

caprica commented 9 years ago

Seems related: http://stackoverflow.com/questions/13821854/strange-crashes-while-calling-jni-code-on-linux-am-i-compiling-my-shared-librar

caprica commented 9 years ago

This also seems similar: https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/810214

caprica commented 9 years ago

After more research I still don't see a way forward on this issue.

If the _IO_STDIN_USED export is the right track, which can not be confirmed, then it implies something like a mismatch between versions of libc/glibc and/or libio somewhere. But diving deeper into this is way outside the scope of this project.