Red5 / red5-hls-plugin

HLS support as a plugin for Red5
Apache License 2.0
80 stars 51 forks source link

Runtime exception when streams ends #4

Open kodjobaah opened 10 years ago

kodjobaah commented 10 years ago

After starting a stream and when the stream ends the following exception is thrown..

[ERROR] [SegmentExecutor-1] org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler - Unexpected error occurred in scheduled task. java.lang.RuntimeException: error Interrupted system call, failed close IContainer com.xuggle.xuggler.IContainer@1647898992[url:null;type:READ;format:com.xuggle.xuggler.IContainerFormat@888047872[];] for redfivempegts:b5c4742a-ab09-42d8-8cf5-0bd27639d015--211a064e-cced-4205-88a6-2cc9b0653413 at org.red5.xuggler.writer.HLSStreamWriter.close(HLSStreamWriter.java:651) ~[hls-plugin-1.1.jar:na] at org.red5.service.httpstream.SegmentFacade$QueueWorker.run(SegmentFacade.java:625) ~[hls-plugin-1.1.jar:na] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) ~[spring-context-3.1.4.RELEASE.jar:3.1.4.RELEASE] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) ~[na:1.7.0_25] at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351) ~[na:1.7.0_25] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178) ~[na:1.7.0_25] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) ~[na:1.7.0_25] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[na:1.7.0_25] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_25] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_25] at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]

kodjobaah commented 10 years ago

According to the Icontainer.close java docs..

If an error occurs after calling close all resources will be closed anyway..so instead of throwing a runtimeexception under this scenario may just logging the error would be more appropriate.

// if we're supposed to, close the container if ((rv = container.close()) < 0) { throw new RuntimeException("error " + IError.make(rv) + ", failed close IContainer " + container + " for " + outputUrl); }

change to:

// if we're supposed to, close the container if ((rv = container.close()) < 0) { log.error("error " + IError.make(rv) + ", failed close IContainer " + container + " for " + outputUrl); }