Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibJitsi.start() freezes on simple OSGi-less project in macOS #519

Open
lgarrido opened this issue Mar 29, 2020 · 1 comment
Open

LibJitsi.start() freezes on simple OSGi-less project in macOS #519

lgarrido opened this issue Mar 29, 2020 · 1 comment

Comments

@lgarrido
Copy link

Description

I made a very simple, "Hello world" kind of project to get a list of the video devices in a MacBook Pro (MacOS 10.13.6 High Sierra).

The call to LibJitsi.start() won't return and the application must be killed.

However, the same project works as expected in Linux.

It is a Maven project fetching libjitsi 1.0-25-g836ce9e7 from https://github.com/jitsi/jitsi-maven-repository, here are the relevant snippets from pom.xml:


		<repository>
			<id>jitsi-maven-repository-releases</id>
			<layout>default</layout>
			<name>Jitsi Maven Repository (Releases)</name>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<url>https://github.com/jitsi/jitsi-maven-repository/raw/master/releases/</url>
		</repository>

		<dependency>
			<groupId>org.jitsi</groupId>
			<artifactId>libjitsi</artifactId>
			<version>1.0-25-g836ce9e7</version>
		</dependency>

The code is just an App.class with the following main() method:


		System.out.println("Starting LibJitsi");
		LibJitsi.start();
		MediaService mediaService = LibJitsi.getMediaService();
		List<MediaDevice> videoDevices = new ArrayList<MediaDevice>();
		videoDevices = mediaService.getDevices(MediaType.VIDEO, MediaUseCase.ANY);
		System.out.println(videoDevices);
		LibJitsi.stop();

Current behavior

This is the end of the application output up to the moment it freezes. Before that, it is Libjitsi just reporting stuff and warning about not finding OSGi, it doesn't seem relevant to the issue but I can copy it here if necessary:


INFORMACIÓN: WebStart classloader
Mar 29, 2020 3:04:33 AM org.jitsi.utils.logging.LoggerImpl log
INFORMACIÓN: failed to find jitsi-default-overrides.properties with class loader, will continue without it.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jitsi.utils.JNIUtils (file:/Users/sistemas/.m2/repository/org/jitsi/jitsi-utils/1.0-39-gd481c98/jitsi-utils-1.0-39-gd481c98.jar) to method java.lang.Runtime.loadLibrary0(java.lang.Class,java.lang.String)
WARNING: Please consider reporting this to the maintainers of org.jitsi.utils.JNIUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Mar 29, 2020 3:04:34 AM org.jitsi.utils.logging.LoggerImpl log
INFORMACIÓN: Initializing audio devices
Mar 29, 2020 3:04:34 AM org.jitsi.utils.logging.LoggerImpl log
INFORMACIÓN: Initializing video devices
Mar 29, 2020 3:04:35 AM org.jitsi.utils.logging.LoggerImpl log
INFORMACIÓN: Webcam available resolution for Cámara FaceTime HD (integrada):java.awt.Dimension[width=1280,height=720]
Mar 29, 2020 3:04:35 AM org.jitsi.utils.logging.LoggerImpl log
INFORMACIÓN: Webcam available resolution for Wirecast Virtual Camera:java.awt.Dimension[width=720,height=480]
2020-03-29 03:04:36.993 java[14848:573372] !!! BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.
2020-03-29 03:04:37.025 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
2020-03-29 03:04:37.159 java[14848:573372] pid(14848)/euid(503) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!

Expected Behavior

The application should list the available video devices. It works as expected in Linux.

Environment details

macOS 10.13.6 High Sierra
Oracle Java SDK 9.0.4

@lgarrido
Copy link
Author

After fiddling a bit, I found out that creating a JFrame (just create it, no need to display it) lets Libjitsi.start() proceed and everything works as it is supposed to.

Just add this somewhere in main():

JFrame frame = new JFrame();

My hypothesis is that creating a JFrame is enough to start up a Cocoa event loop and that satisfies whatever macOS native API Libjitsi is using that complains about the main thread.

Placing it after Libjitsi.start() works too, but probably there is some kind of thread race involved, so it might fail on a faster machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant