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

Seemingly benign NPE from initializing InputSystem for a headless server #3793

Closed
Cervator opened this issue Dec 7, 2019 · 2 comments · Fixed by #4907
Closed

Seemingly benign NPE from initializing InputSystem for a headless server #3793

Cervator opened this issue Dec 7, 2019 · 2 comments · Fixed by #4907
Labels
Topic: UI/UX Requests, Issues and Changes related to screens, artwork, sound and overall user experience Type: Bug Issues reporting and PRs fixing problems

Comments

@Cervator
Copy link
Member

Cervator commented Dec 7, 2019

What you were trying to do

Test stuff! Clear logs are happy logs

What actually happened

A NullPointerException got logged breaking the perfect zen moment of staring at the logs :-( Actually, not really new, been seeing this for months if not longer.

Chances are some code gets initialized that makes no sense in a headless situation. May also want to check the ModuleTestingEnvironment starting a test since it uses both a headless server and headless clients.

Need to find where it gets logged then see if it makes sense to do a test of the network mode or something to only attempt that initialization where it makes sense, trying a little detective work in case it does actually result in something undesirable.

How to reproduce

  • Run a headless server, seemingly any config
  • Look through the logging, notice NPE during startup (after discovering modules, before activating them)
  • Observe the server still working just fine, so it doesn't seem to be very bad ..

Log snippet

20:27:10.450 [main] INFO  o.t.i18n.TranslationSystemImpl - Discovered engine:menu_ru
20:27:10.754 [main] INFO  o.terasology.engine.TerasologyEngine - Initialization completed in 12.24sec.
20:27:11.500 [main] ERROR o.t.engine.ComponentSystemManager - Failed to initialise system org.terasology.input.InputSystem@374b6e33
java.lang.NullPointerException: null
	at org.terasology.input.InputSystem.initialise(InputSystem.java:124)
	at org.terasology.engine.ComponentSystemManager.initialiseSystem(ComponentSystemManager.java:160)
	at org.terasology.engine.ComponentSystemManager.initialise(ComponentSystemManager.java:144)
	at org.terasology.engine.subsystem.headless.mode.StateHeadlessSetup.init(StateHeadlessSetup.java:104)
	at org.terasology.engine.TerasologyEngine.switchState(TerasologyEngine.java:550)
	at org.terasology.engine.TerasologyEngine.changeState(TerasologyEngine.java:533)
	at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:399)
	at org.terasology.engine.Terasology.main(Terasology.java:145)
20:27:12.389 [main] WARN  o.t.engine.internal.TimeBase - Delta too great (13205), capping to 1000
20:27:12.400 [main] INFO  o.t.e.m.loadProcesses.RegisterMods - Activating module: engine:2.2.1-SNAPSHOT
@Cervator Cervator added Topic: UI/UX Requests, Issues and Changes related to screens, artwork, sound and overall user experience Good First Issue Good for learners that are new to Terasology labels Dec 7, 2019
@DarkWeird
Copy link
Contributor

This is bad "Good First Issue".

I looked into this place....

You need remove or replace on stub: NuiManager/InputSystem in headless context.

NuiManager is used almost everywhere. (via CoreRegistry too)
Сlose your eyes to 1 NPE, easier than refactoring the entire engine and major systems

@Cervator Cervator removed the Good First Issue Good for learners that are new to Terasology label Apr 10, 2020
@Cervator
Copy link
Member Author

Belatedly removed the GFI label. Also want to link this to #3819 since if we end up extracting NUI that might be "big enough" to where better stubbing the UI in headless may make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Topic: UI/UX Requests, Issues and Changes related to screens, artwork, sound and overall user experience Type: Bug Issues reporting and PRs fixing problems
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants