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

opp_neddoc does not work in headless mode #1043

Open
haug-den-lucas opened this issue Aug 31, 2023 · 5 comments
Open

opp_neddoc does not work in headless mode #1043

haug-den-lucas opened this issue Aug 31, 2023 · 5 comments
Assignees
Labels
feature A feature request
Milestone

Comments

@haug-den-lucas
Copy link

haug-den-lucas commented Aug 31, 2023

I tried to set up a Gitlab pipeline which automatically generates my NED documentation.

opp_neddoc however, does not seem to work without a connected display (which seems weird, as it is supposed to be a command line tool)

What I've tried:

1: Use the omnetpp docker container:
Docker Container: ghcr.io/omnetpp/omnetpp:u22.04-6.0.1
Running opp_neddoc fails with "The IDE is not installed, but it is required by opp_neddoc!"

  1. Use the omnetpp-gui docker container:
    Docker Container: ghcr.io/omnetpp/omnetpp-gui:u22.05-6.0.1
    Running opp_neddoc fails with
root@dc19269fad3d:~/inet# opp_neddoc .
OMNeT++ IDE:
An error has occurred. See the log file
/tmp/tmp.uttWk716CT/.metadata/.log.

So i changed

{ $LAUNCHER "$@" $WORKSPACE_ARGS 2>&1 1>&3 | grep 'Error:' 1>&2 && exit 1; } 3>&1

to $LAUNCHER "$@" $WORKSPACE_ARGS 2>&1 to actually see some logs and then it fails with

root@dc19269fad3d:~/inet# opp_neddoc .
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
OMNeT++ IDE: Cannot open display: 
OMNeT++ IDE:
An error has occurred. See the log file
/tmp/tmp.Zn1RwJi5nq/.metadata/.log.

So the problem seems to be that opp_neddoc is only able to run on a machine with a display which feels quite weird as it is supposed to be a command line tool.

Additional testing:
I install OMNeT++ on a headless Ubuntu-Server and connected via SSH to it.

  1. If I do not use X11 forwarding the opp_neddoc command fails with the error messages above
  2. If I enable X11 forwarding, the command executed just perfectly (but without ever showing a screen)

These is no other difference between the two tests, so for some reason the opp_neddoc command is unable to execute on a headless server even though it does never create a GUI window.

Is there any way to work around this?

@avarga
Copy link
Contributor

avarga commented Sep 1, 2023

opp_neddoc tries to run Eclipse (the IDE) in "headless" mode, but looks like it still needs the display. Possibly because of the code that renders the previews of NED compound modules.

Running opp_neddoc with xvfb-run seems to be the workaround. It creates a virtual framebuffer for the duration of running the program you give it as argument.

Example: xvfb-run opp_neddoc .

@haug-den-lucas
Copy link
Author

haug-den-lucas commented Sep 1, 2023

Running opp_neddoc with xvfb-run seems to be the workaround. It creates a virtual framebuffer for the duration of running the program you give it as argument.

Example: xvfb-run opp_neddoc .

Thanks for your response.
I already tried this and interestingly it works on a headless server, but when installing xvfb inside the current omnetpp-gui docker container it seems to freeze (no dots appear within 10min, even though they do appear almost immediately when running the same command on the same headless machine the docker container is running on).

omnetpp-gui-6.0.1:/root/models/inet$ xvfb-run opp_neddoc --verbose .
Generating NED documentation for 'inet'.

^C
omnetpp-gui-6.0.1:/root/models/inet$

There is probably some way to get it running in docker, but I myself wasn't able to do it.
So it would still be preferable if opp_neddoc could run natively on a headless machine.

@avarga
Copy link
Contributor

avarga commented Sep 1, 2023

when installing xvfb inside the current omnetpp-gui docker container it seems to freeze

That was unexpected, thanks for the info.

So it would still be preferable if opp_neddoc could run natively on a headless machine.

We'll try to fix it in the IDE Java code, but we'll be unable to pull it off if it requires changes in the Eclipse platform libs such as SWT...

@rhornig
Copy link
Contributor

rhornig commented Sep 20, 2023

Running with xvfb-run works correctly for me in a desktop shell:

GDK_BACKEND=x11 DISPLAY= xvfb-run opp_neddoc --verbose .
Generating NED documentation for 'aloha'.
............

I have not tried in a docker container though.

@haug-den-lucas
Copy link
Author

Running with xvfb-run works correctly for me in a desktop shell:

GDK_BACKEND=x11 DISPLAY= xvfb-run opp_neddoc --verbose .
Generating NED documentation for 'aloha'.
............

I have not tried in a docker container though.

Yes, interestingly this works perfectly well for me even on a headless server:

X@X:~/tmp/inet4.5$ GDK_BACKEND=x11 DISPLAY= xvfb-run opp_neddoc --verbose .
Generating NED documentation for 'inet'.
..........^C
X@X:~/tmp/inet4.5$

However if i run the official omnetpp-gui docker container:

And execute the following script in it:

apt-get update
apt-get -y install xvfb
git clone --depth=1 https://github.com/inet-framework/inet.git
cd inet

and then

omnetpp-gui-6.0.1:/root/models/inet$ GDK_BACKEND=x11 DISPLAY= xvfb-run opp_neddoc --verbose .
Generating NED documentation for 'inet'.

^C
omnetpp-gui-6.0.1:/root/models/inet$

nothing happens until cancelling (I waited for multiple minutes, on the same machine outside the docker container the first dots appeared after a few seconds).

Interestingly in the second case there is an additional new line before canceling.

Or summarized: xvfb-run opp_neddoc works perfectly on my desktop, on a headless server but not in a docker container.

@rhornig rhornig self-assigned this Feb 1, 2024
@rhornig rhornig added this to the postponed indefinitely milestone Feb 1, 2024
@rhornig rhornig added the feature A feature request label Feb 1, 2024
@rhornig rhornig modified the milestones: postponed indefinitely, 6.1 Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request
Projects
None yet
Development

No branches or pull requests

3 participants