CompletableFuture doesn't raise exceptions for runtime errors
See original GitHub issueDescription
Errors happening after FFMpeg’s startup don’t raise exceptions. FFMpeg startup errors are raised correctly.
Steps to reproduce
- Run an Nginx server with nginx-rtmp-module installed (such as the
alfg/nginx-rtmp
docker image) - Run an FFMpeg process with the following command
ffmpeg -f lavfi -i testsrc=size=1920x1080:rate=25 -f lavfi -i sine=f=1:b=2000 -shortest -f flv rtmp://localhost:1935/proxy/source
- Run the following test class
import com.github.kokorin.jaffree.StreamType;
import com.github.kokorin.jaffree.ffmpeg.FFmpeg;
import com.github.kokorin.jaffree.ffmpeg.UrlInput;
import com.github.kokorin.jaffree.ffmpeg.UrlOutput;
class TestClass {
public static void main(String[] args) {
FFmpeg.atPath()
.addInput(UrlInput.fromUrl("rtmp://localhost:1935/hls/source"))
.addOutput(UrlOutput.toUrl("rtmp://localhost:1935/hls/target")
.setFormat("flv")
.addMap(0, StreamType.AUDIO)
.addMap(0, StreamType.VIDEO)
.setCodec(StreamType.AUDIO, "copy")
.setCodec(StreamType.VIDEO, "copy")
)
.executeAsync()
.toCompletableFuture()
.exceptionally(error -> {
System.err.println("An error has occured");
error.printStackTrace();
return null;
})
.join();
}
}
- Stop the Nginx server
This error message will come up but no exception will be raised.
c.g.k.jaffree.ffmpeg.FFmpegResultReader : [error] rtmp://localhost:1935/hls/source: Input/output error
Expected behavior
An exception should be raised because this issue causes FFMpeg to be stopped.
Logs
c.g.k.jaffree.ffmpeg.FFmpegResultReader : [error] rtmp://localhost:1935/hls/source: Input/output error
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Handling Runtime Exception in CompletableFuture in java8
Question is Lets say if i want to throw runtime exception and want application to stop. Basically if i throw Runtime exception ,...
Read more >3 Ways to Handle Exception In Completable Future
Exception handling is important when writing code with CompletableFuture . CompletableFuture provides three methods to handle them: handle() , ...
Read more >Handling Errors in CompletableFuture java 8 - YouTube
In this video tutorial we will learn how to handle exception in CompletableFuture in java 8 using a demo project.Below is the GitHub...
Read more >Java's CompletableFuture and typed exception handling
One thing that most asynchronous computing models suffer from – and Java's CompletableFuture is no exception – is the loss of typed ...
Read more >CompletableFuture (Java SE 17 & JDK 17) - Oracle Help Center
Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete, with the same result. Otherwise, if it completed ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You could create a branch from develop branch. Usually with GitHub one creates a branch in own fork project. When it’s done, PR could be created.
Which branch must I start from ? I can see
develop
is behindmaster
. Do I need specific rights to push my branch ?