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

Using CLI mode on a server with no X #789

Open
hanksims opened this issue Jan 24, 2024 · 9 comments
Open

Using CLI mode on a server with no X #789

hanksims opened this issue Jan 24, 2024 · 9 comments

Comments

@hanksims
Copy link

I'd love to use rcv on a Linux server in CLI mode. However, I'm unable to. I get this:

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.UnsupportedOperationException: Unable to open DISPLAY

Can this be right? Can X be removed as a requirement for command-line operations? Barring that, does anyone have a workaround?

@tarheel
Copy link
Contributor

tarheel commented Jan 26, 2024

@artoonie thoughts on this? I agree that in theory this restriction seems unnecessary.

@artoonie
Copy link
Collaborator

Agreed.

Is this fixed if you export DISPLAY=:0? Sometimes it's as easy as that.

If not, we can look into fixing it correctly (@yezr would love help prioritizing).

@hanksims
Copy link
Author

I just tried it. Same error, alas.

My workaround in the meanwhile -- hopefully temporarily? -- is to run an xvfb server on my machine to fake out rcv. It takes up enough memory to make it hurt a little bit.

@yezr
Copy link
Collaborator

yezr commented Jan 30, 2024

@hanksims thanks for the heads up. Do you know how many people this effects? Is this all linux machines (or most?)

@hanksims
Copy link
Author

I believe it would affect all or most Linux machines that are used as servers, in the cloud, where X display servers are uncommon.

@semperstew
Copy link

Is there any update on this? I have a use-case that requires running rcv in a docker container without X.

@yezr
Copy link
Collaborator

yezr commented Jul 22, 2024

What is your all's use case? That will help me find a priority. Does @hanksims workaround also work for you?

I will add that the project's current focus is to finish the v2.0 priority list here for upcoming VVSG certification. It will be hard to find space for this above any of that work. If you all can submit a PR with a fix that would make it easier to prioritize. But even then, we have to take resources away from reviewing the current priority list to review any fix.

@nikomaresco
Copy link

nikomaresco commented Jul 23, 2024

@semperstew and i have a use case in which we're conducting automated polling. we fetch data from S3, push it through an ETL pipeline, and then run it through RCTab in order to get the election results. we've got a poll going in every state, updating a couple of times per day. at the end we upload our results to rcvis.com to visualize them (great tool, that!).

what's weird too, is that using @hanksims workaround i was able to get RCTab running in my local environment (Ubuntu 20.04.6), but not in EC2 (Debian 11). still trying to figure out why that could be.

these are the changes i made to the startup script get it running in Ubuntu:

#!/bin/sh
DIR="${0%/*}"
Xvfb :99 -screen 0 1024x768x16 &   # Start Xvfb in the background
export DISPLAY=:99                 # Set the DISPLAY variable to use Xvfb
"$DIR/java" -Djava.awt.headless=true -p "$DIR/../app" -m network.brightspots.rcv/network.brightspots.rcv.Main  "$@"

@nikomaresco
Copy link

excellent news. some digging led me to this issue, which suggested to install lib-gtk-3-0. running RCTab with the above modifications to startup gets it working!

you can install the package with apt install libgtk-3-0.

also, note that the startup script i shared above will attempt to start Xvfb every time you run the tabulator, which doesn't do anything detrimental except some angry log messages. but a better script would check if it's currently running first, which a future reader might want to do in production.

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

6 participants