Re: [xuggler-users] Problem running Xuggle 5.4

279 views
Skip to first unread message
Message has been deleted

Art Clarke

unread,
May 4, 2012, 1:53:24 PM5/4/12
to xuggle...@googlegroups.com
That's a good catch.  It may explain another error happening for some users.  In Xuggler 5.4 we create a temporary file on disk, using Java's File#createTempFile:

http://docs.oracle.com/javase/1.5.0/docs/api/java/io/File.html#createTempFile%28java.lang.String,%20java.lang.String%29

We then load that temporary file (which will have the contents of the correct libxuggle native object copied to it) as a dynamic library in Java.

For the prefix variable I pass in "xuggle" and rely on the createTempFile call to create a unique file.  However my guess is Java ensures the file is unique PER PROCESS.  In reality, we need to create a unique file per invocation of a load.

To try a workaround, modify src/com/xuggle/ferry/JNILibraryLoader.java line 275 to add a random string to the prefix and see if that helps the problem go away (it is left as an exercise for the reader to how to do this without recompiling all the native code, but if you like, a quick and dirty hack is:
  1. copy your current xuggle-xuggler.jar file somewhere
  2. make the edits and then run "ant stage-java" in your source tree; this will generate a new xuggle-xuggler.jar (although native code might not be staged)
  3. unzip dist/lib/xuggle-xuggle.jar and find the file com/xuggle/ferry/JNILibraryLoader.class
  4. unzip your old xuggle-xuggler.jar to a location, and replace com/xuggle/ferry/JNILibraryLoader.class with your modified class file
  5. re-zip the directory to create your new xuggle-xuggler.jar file)

If that works, let me know.  I cannot test it today because in a fit of intense stupidity I just spilled hot tea all over my development laptop :(

- Art


On Fri, May 4, 2012 at 7:39 AM, Luuk Dominiek Jansen OP <luuka...@gmail.com> wrote:
I am trying to run Xuggle 5.4 on a server, and have an exception I do not know how to deal with. The same code works fine on two other server, and also on the same server under another application (Playframework). The fact that it run under another application makes me suggest that that might be the fault.

The root of the error seems to be that Xuggle tries to create a temp file and the access is denied. How can I figure out where this is?

Is it possibly this is a location the other install has already used, and which is running under another user account? If I run it as root it works fine, suggesting that it is just a permission issue, but I cannot find what to change as the working directory etc. is all owned by the user running it. I don't want the framework to run as root.

2012-05-04 08:49:01,985 ERROR ~ could not create temp file: {}
java.io.IOException: Permission denied
       at java.io.UnixFileSystem.createFileExclusively(Native Method) ~[na:1.6.0_26]
       at java.io.File.checkAndCreate(File.java:1704) ~[na:1.6.0_26]
       at java.io.File.createTempFile(File.java:1792) ~[na:1.6.0_26]
       at com.xuggle.ferry.JNILibrary.unpackLibrary(JNILibrary.java:274) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.ferry.JNILibrary.loadFromClasspath(JNILibrary.java:195) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:176) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:158) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.ferry.FerryJNI.<clinit>(FerryJNI.java:16) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.ferry.Ferry.<clinit>(Ferry.java:25) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.xuggler.IContainer.<clinit>(IContainer.java:1622) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.mediatool.MediaReader.<init>(MediaReader.java:137) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.mediatool.ToolFactory.makeReader(ToolFactory.java:77) [xuggle-xuggler-5.4.jar:5.4.0]
       at logic.server.MediaCoder.createEncodingJobs(MediaCoder.java:39) [idoms-server:na]
       at controllers.FileCopyJob$ProgressListener.actionPerformed(FileCopyJob.java:127) [idoms-server:na]
       at controllers.FileCopyJob$DownloadCountingOutputStream.afterWrite(FileCopyJob.java:84) [idoms-server:na]
       at org.apache.commons.io.output.ProxyOutputStream.write(ProxyOutputStream.java:92) [commons-io-2.0.1.jar:2.0.1]
       at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1263) [commons-io-2.0.1.jar:2.0.1]
       at org.apache.commons.io.IOUtils.copy(IOUtils.java:1236) [commons-io-2.0.1.jar:2.0.1]
       at controllers.FileCopyJob.doJob(FileCopyJob.java:58) [idoms-server:na]
       at play.jobs.Job.doJobWithResult(Job.java:50) [play-1.2.4.jar:na]
       at play.jobs.Job.call(Job.java:146) [play-1.2.4.jar:na]
       at play.jobs.Job$1.call(Job.java:66) [play-1.2.4.jar:na]
       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_26]
       at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_26]
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) [na:1.6.0_26]
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) [na:1.6.0_26]
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_26]
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_26]
       at java.lang.Thread.run(Thread.java:662) [na:1.6.0_26]
2012-05-04 08:49:02,003 ERROR ~ could not create temp file: {}
java.io.IOException: Permission denied
       at java.io.UnixFileSystem.createFileExclusively(Native Method) ~[na:1.6.0_26]
       at java.io.File.checkAndCreate(File.java:1704) ~[na:1.6.0_26]
       at java.io.File.createTempFile(File.java:1792) ~[na:1.6.0_26]
       at com.xuggle.ferry.JNILibrary.unpackLibrary(JNILibrary.java:274) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.ferry.JNILibrary.loadFromClasspath(JNILibrary.java:195) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:176) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:158) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.ferry.FerryJNI.<clinit>(FerryJNI.java:16) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.ferry.Ferry.<clinit>(Ferry.java:25) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.xuggler.IContainer.<clinit>(IContainer.java:1622) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.mediatool.MediaReader.<init>(MediaReader.java:137) [xuggle-xuggler-5.4.jar:5.4.0]
       at com.xuggle.mediatool.ToolFactory.makeReader(ToolFactory.java:77) [xuggle-xuggler-5.4.jar:5.4.0]
       at logic.server.MediaCoder.createEncodingJobs(MediaCoder.java:39) [idoms-server:na]
       at controllers.FileCopyJob$ProgressListener.actionPerformed(FileCopyJob.java:127) [idoms-server:na]
       at controllers.FileCopyJob$DownloadCountingOutputStream.afterWrite(FileCopyJob.java:84) [idoms-server:na]
       at org.apache.commons.io.output.ProxyOutputStream.write(ProxyOutputStream.java:92) [commons-io-2.0.1.jar:2.0.1]
       at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1263) [commons-io-2.0.1.jar:2.0.1]
       at org.apache.commons.io.IOUtils.copy(IOUtils.java:1236) [commons-io-2.0.1.jar:2.0.1]
       at controllers.FileCopyJob.doJob(FileCopyJob.java:58) [idoms-server:na]
       at play.jobs.Job.doJobWithResult(Job.java:50) [play-1.2.4.jar:na]
       at play.jobs.Job.call(Job.java:146) [play-1.2.4.jar:na]
       at play.jobs.Job$1.call(Job.java:66) [play-1.2.4.jar:na]
       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_26]
       at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_26]
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) [na:1.6.0_26]
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) [na:1.6.0_26]
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_26]
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_26]
       at java.lang.Thread.run(Thread.java:662) [na:1.6.0_26]
2012-05-04 08:49:02,015 ERROR ~ Could not load library: xuggle; version: 5; Visit http://www.xuggle.com/xuggler/faq/ to find common solutions to this problem
08:49:02,115 ERROR ~

--
You received this message because you are subscribed to the Google Groups "xuggler-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/xuggler-users/-/0eEc99A5fDsJ.
To post to this group, send email to xuggle...@googlegroups.com.
To unsubscribe from this group, send email to xuggler-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xuggler-users?hl=en.




--
http://www.xuggle.com/
xu‧ggle (zŭ' gl) v. To freely encode, decode, and experience audio and video.

Use Xuggle to get the power of FFmpeg in Java.

Luuk Dominiek Jansen OP

unread,
May 4, 2012, 4:41:20 PM5/4/12
to xuggle...@googlegroups.com
My initial attempt failed.

I changed the line (in JNILibrary, not JNILibraryLoader) to:
        lib = File.createTempFile("prod-xuggle", JNIEnv.getEnv().getOSFamily() == JNIEnv.OSFamily.WINDOWS ? ".dll" : null, dir);

Is that what you meant (with the addition of prod-xuggle). I git the same error but a line lower, which makes sense as I put in a return, so it is the updated class.
I will try again and add a random number as prefix, but just like to confirm that that is the right solution.

Luuk Dominiek Jansen OP

unread,
May 4, 2012, 4:43:57 PM5/4/12
to xuggle...@googlegroups.com
ps I think I had two errors before, only one now. Could it also be a problem with multiple threats?

2012-05-04 21:33:57,255 ERROR ~ could not create temp file: {}
java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method) ~[na:1.6.0_26]
at java.io.File.checkAndCreate(File.java:1704) ~[na:1.6.0_26]
at java.io.File.createTempFile(File.java:1792) ~[na:1.6.0_26]
at com.xuggle.ferry.JNILibrary.unpackLibrary(JNILibrary.java:275) [xuggle-xuggler-5.4.jar:na]
at com.xuggle.ferry.JNILibrary.loadFromClasspath(JNILibrary.java:195) [xuggle-xuggler-5.4.jar:na]
at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:176) [xuggle-xuggler-5.4.jar:na]
at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:158) [xuggle-xuggler-5.4.jar:na]
at com.xuggle.ferry.FerryJNI.<clinit>(FerryJNI.java:16) [xuggle-xuggler-5.4.jar:na]
at com.xuggle.ferry.Ferry.<clinit>(Ferry.java:25) [xuggle-xuggler-5.4.jar:na]
at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19) [xuggle-xuggler-5.4.jar:na]
at com.xuggle.xuggler.ICodec$ID.<clinit>(ICodec.java:758) [xuggle-xuggler-5.4.jar:na]
at models.MediaRole.<init>(MediaRole.java:30) [idoms-server:na]
at models.MediaRole.getCoderSettings(MediaRole.java:42) [idoms-server:na]
at models.MediaFile.getCoderSettings(MediaFile.java:111) [idoms-server:na]
at logic.server.MediaCoder.encodeMediaFile(MediaCoder.java:118) [idoms-server:na]
at controllers.MediaCoderProcess.doJob(MediaCoderProcess.java:54) [idoms-server:na]
at play.jobs.Job.doJobWithResult(Job.java:50) [play-1.2.4.jar:na]
at play.jobs.Job.call(Job.java:146) [play-1.2.4.jar:na]
at play.jobs.Job.run(Job.java:132) [play-1.2.4.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_26]
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) [na:1.6.0_26]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) [na:1.6.0_26]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) [na:1.6.0_26]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) [na:1.6.0_26]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) [na:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_26]
2012-05-04 21:33:57,333 ERROR ~ Could not load library: xuggle; version: 5; Visit http://www.xuggle.com/xuggler/faq/ to find common solutions to this problem
21:33:57,359 ERROR ~ 

@6a98h14bg
Error during job execution (controllers.MediaCoderProcess)

Oops: UnsatisfiedLinkError
An unexpected error occured caused by exception UnsatisfiedLinkError: no xuggle in java.library.path

play.exceptions.UnexpectedException: Unexpected Error
at play.Invoker$Invocation.onException(Invoker.java:244)
at play.jobs.Job.onException(Job.java:124)
at play.jobs.Job.call(Job.java:163)
at Invocation.Job(Play!)
Caused by: java.lang.UnsatisfiedLinkError: no xuggle in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at com.xuggle.ferry.JNILibraryLoader.loadLibrary0(JNILibraryLoader.java:268)
at com.xuggle.ferry.JNILibraryLoader.loadLibrary(JNILibraryLoader.java:171)
at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:161)
at com.xuggle.ferry.FerryJNI.<clinit>(FerryJNI.java:16)
at com.xuggle.ferry.Ferry.<clinit>(Ferry.java:25)
at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19)
at com.xuggle.xuggler.ICodec$ID.<clinit>(ICodec.java:758)
at models.MediaRole.<init>(MediaRole.java:30)
at models.MediaRole.getCoderSettings(MediaRole.java:42)
at models.MediaFile.getCoderSettings(MediaFile.java:111)
at logic.server.MediaCoder.encodeMediaFile(MediaCoder.java:118)
at controllers.MediaCoderProcess.doJob(MediaCoderProcess.java:54)
at play.jobs.Job.doJobWithResult(Job.java:50)
at play.jobs.Job.call(Job.java:146)
... 1 more
Message has been deleted
Message has been deleted

Luuk Dominiek Jansen OP

unread,
May 5, 2012, 9:38:01 AM5/5/12
to xuggle...@googlegroups.com
First of all, sorry for the many messages yesterday. I have difficulty with group.google.com, as what I see does not seem to be what is actually there. Must eb a caching issue or so, hence the repeated posts (and now the original message being deleted)

Anyway, I did a bit more investigation.
I added a debug message to see what the temp dir was, and in my situation it was /tmp/xuggle. Checking this it was indeed created by the user of the other application, and removing it solved the problem. Changing the name as suggested above did not fix the problem, so I wonder if the temp-dir name itself is set somewhere else?

Anyway, I have my server working, so we have diagnosed the error! I had to revert back to the origional .jar file, as building it the way suggested caused a class not found exception. I don't know the reason, but as it worked well enough to give me the fix I didn't investigate. With the origional .jar it works fine now!
Thanks for the help. If you would like more information about my setup/experience to help creating a permanent fix please let me know!



On Friday, 4 May 2012 18:53:24 UTC+1, Art Clarke wrote:
That's a good catch.  It may explain another error happening for some users.  In Xuggler 5.4 we create a temporary file on disk, using Java's File#createTempFile:

http://docs.oracle.com/javase/1.5.0/docs/api/java/io/File.html#createTempFile%28java.lang.String,%20java.lang.String%29

We then load that temporary file (which will have the contents of the correct libxuggle native object copied to it) as a dynamic library in Java.

For the prefix variable I pass in "xuggle" and rely on the createTempFile call to create a unique file.  However my guess is Java ensures the file is unique PER PROCESS.  In reality, we need to create a unique file per invocation of a load.

To try a workaround, modify src/com/xuggle/ferry/JNILibraryLoader.java line 275 to add a random string to the prefix and see if that helps the problem go away (it is left as an exercise for the reader to how to do this without recompiling all the native code, but if you like, a quick and dirty hack is:
  1. copy your current xuggle-xuggler.jar file somewhere
  2. make the edits and then run "ant stage-java" in your source tree; this will generate a new xuggle-xuggler.jar (although native code might not be staged)
  3. unzip dist/lib/xuggle-xuggle.jar and find the file com/xuggle/ferry/JNILibraryLoader.class
  4. unzip your old xuggle-xuggler.jar to a location, and replace com/xuggle/ferry/JNILibraryLoader.class with your modified class file
  5. re-zip the directory to create your new xuggle-xuggler.jar file)

If that works, let me know.  I cannot test it today because in a fit of intense stupidity I just spilled hot tea all over my development laptop :(

- Art


On Fri, May 4, 2012 at 7:39 AM, Luuk Dominiek Jansen OPwrote:
To unsubscribe from this group, send email to xuggler-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/xuggler-users?hl=en.

Reply all
Reply to author
Forward
0 new messages