Giter Club home page Giter Club logo

facadeserver's People

Contributors

cervator avatar darkweird avatar gianluca-nitti avatar inei1 avatar jdrueckert avatar msteiger avatar pollend avatar skaldarnar avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facadeserver's Issues

Three NullPointerException's

L.S.

I try to startup a Facade server as described in https://github.com/MovingBlocks/FacadeServer/blob/develop/README.md.

First I noticed one thing, the description talkes about './gradlew facades:Server:run' but the Facade server can only be started with './gradlew facades:FacadeServer:run'. I don;t know if this is a type or if I do something wrong.

But after the start I get three NullPointerExceptions and only port 8080 is opened but accessing this port with a browser results in a 404.
Do you know what is going wrong?

These are the errors:

2020-05-22T20:38:50.028+0200 [QUIET] [system.out] 20:38:50.028 [main] INFO  o.terasology.engine.TerasologyEngine - Initialization completed in 1.66sec.
2020-05-22T20:38:50.395+0200 [QUIET] [system.out] 20:38:50.395 [main] ERROR o.t.engine.ComponentSystemManager - Failed to initialise system org.terasology.input.InputSystem@323efafe
2020-05-22T20:38:50.396+0200 [QUIET] [system.out] java.lang.NullPointerException: null
2020-05-22T20:38:50.396+0200 [QUIET] [system.out]       at org.terasology.input.InputSystem.initialise(InputSystem.java:124)
2020-05-22T20:38:50.396+0200 [QUIET] [system.out]       at org.terasology.engine.ComponentSystemManager.initialiseSystem(ComponentSystemManager.java:161)
2020-05-22T20:38:50.396+0200 [QUIET] [system.out]       at org.terasology.engine.ComponentSystemManager.initialise(ComponentSystemManager.java:145)
2020-05-22T20:38:50.396+0200 [QUIET] [system.out]       at org.terasology.engine.subsystem.headless.mode.StateHeadlessSetup.init(StateHeadlessSetup.java:104)
2020-05-22T20:38:50.396+0200 [QUIET] [system.out]       at org.terasology.engine.TerasologyEngine.switchState(TerasologyEngine.java:550)
2020-05-22T20:38:50.396+0200 [QUIET] [system.out]       at org.terasology.engine.TerasologyEngine.changeState(TerasologyEngine.java:533)
2020-05-22T20:38:50.396+0200 [QUIET] [system.out]       at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:399)
2020-05-22T20:38:50.396+0200 [QUIET] [system.out]       at org.terasology.web.EngineRunner.runEngine(EngineRunner.java:66)
2020-05-22T20:38:50.396+0200 [QUIET] [system.out]       at org.terasology.web.ServerMain.main(ServerMain.java:124)
2020-05-22T20:38:50.397+0200 [QUIET] [system.out] 20:38:50.398 [main] WARN  o.t.e.s.h.mode.StateHeadlessSetup - ModuleRegistry has no latest version for module coresamplegameplay
2020-05-22T20:38:50.397+0200 [QUIET] [system.out] 20:38:50.398 [main] ERROR o.terasology.engine.TerasologyEngine - Uncaught exception, attempting clean game shutdown
2020-05-22T20:38:50.397+0200 [QUIET] [system.out] java.lang.NullPointerException: null
2020-05-22T20:38:50.397+0200 [QUIET] [system.out]       at org.terasology.engine.module.StandardModuleExtension.getBooleanExtension(StandardModuleExtension.java:74)
2020-05-22T20:38:50.397+0200 [QUIET] [system.out]       at org.terasology.engine.module.StandardModuleExtension.isGameplayModule(StandardModuleExtension.java:65)
2020-05-22T20:38:50.397+0200 [QUIET] [system.out]       at org.terasology.engine.subsystem.headless.mode.StateHeadlessSetup.createGameManifest(StateHeadlessSetup.java:145)
2020-05-22T20:38:50.397+0200 [QUIET] [system.out]       at org.terasology.engine.subsystem.headless.mode.StateHeadlessSetup.init(StateHeadlessSetup.java:111)
2020-05-22T20:38:50.397+0200 [QUIET] [system.out]       at org.terasology.engine.TerasologyEngine.switchState(TerasologyEngine.java:550)
2020-05-22T20:38:50.397+0200 [QUIET] [system.out]       at org.terasology.engine.TerasologyEngine.changeState(TerasologyEngine.java:533)
2020-05-22T20:38:50.397+0200 [QUIET] [system.out]       at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:399)
2020-05-22T20:38:50.397+0200 [QUIET] [system.out]       at org.terasology.web.EngineRunner.runEngine(EngineRunner.java:66)
2020-05-22T20:38:50.397+0200 [QUIET] [system.out]       at org.terasology.web.ServerMain.main(ServerMain.java:124)
2020-05-22T20:38:50.397+0200 [QUIET] [system.out] 20:38:50.398 [main] INFO  o.terasology.engine.TerasologyEngine - Shutting down Terasology...
2020-05-22T20:38:50.467+0200 [ERROR] [system.err] Exception in thread "main" java.lang.NullPointerException
2020-05-22T20:38:50.467+0200 [ERROR] [system.err]       at org.terasology.engine.module.StandardModuleExtension.getBooleanExtension(StandardModuleExtension.java:74)
2020-05-22T20:38:50.467+0200 [ERROR] [system.err]       at org.terasology.engine.module.StandardModuleExtension.isGameplayModule(StandardModuleExtension.java:65)
2020-05-22T20:38:50.467+0200 [ERROR] [system.err]       at org.terasology.engine.subsystem.headless.mode.StateHeadlessSetup.createGameManifest(StateHeadlessSetup.java:145)
2020-05-22T20:38:50.467+0200 [ERROR] [system.err]       at org.terasology.engine.subsystem.headless.mode.StateHeadlessSetup.init(StateHeadlessSetup.java:111)
2020-05-22T20:38:50.467+0200 [ERROR] [system.err]       at org.terasology.engine.TerasologyEngine.switchState(TerasologyEngine.java:550)
2020-05-22T20:38:50.467+0200 [ERROR] [system.err]       at org.terasology.engine.TerasologyEngine.changeState(TerasologyEngine.java:533)
2020-05-22T20:38:50.467+0200 [ERROR] [system.err]       at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:399)
2020-05-22T20:38:50.467+0200 [ERROR] [system.err]       at org.terasology.web.EngineRunner.runEngine(EngineRunner.java:66)
2020-05-22T20:38:50.467+0200 [ERROR] [system.err]       at org.terasology.web.ServerMain.main(ServerMain.java:124)
2020-05-22T20:38:50.899+0200 [LIFECYCLE] [org.gradle.cache.internal.DefaultFileLockManager]

HeadlessClient instances should be registered to the engine's NetworkSystem (not just to the EntityManager)

What the title says. Right now clients which connects via the HTTP/WebSocket service exposed by FacadeServer are registered to the engine's EntitySystem, so that they can run console commands - however, it would be better to register them to the NetworkSystem (which job is to keep track of all the connected clients).
This should allow ComponentSystems to receive event notifications (e.g. onConnected) related to headless clients, like they do for regular clients.
Besides improving the code structure (with NetworkSystem handling all kinds of clients, including "special" ones), right now an use case where this would improve usability is in the features intruduced in #17 (see this comment).

Unit test "AuthenticationHandshakeHandlerTest.testBadSignature" isn't fully deterministic and can (rarely) fail

Adding this mainly as a note to myself for when I have the time to fix it.

As the title says, the unit test AuthenticationHandshakeHandlerTest.testBadSignature is not fully deterministic (it uses some randomly generated values) and can sometimes fail with the following exception:

java.lang.Exception: Unexpected exception, expected<org.terasology.web.authentication.AuthenticationFailedException> but was<java.lang.ArithmeticException>

	at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:28)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.ArithmeticException: BigInteger not invertible.
	at java.math.MutableBigInteger.modInverse(MutableBigInteger.java:2106)
	at java.math.MutableBigInteger.mutableModInverse(MutableBigInteger.java:1982)
	at java.math.BigInteger.modInverse(BigInteger.java:2905)
	at java.math.BigInteger.modPow(BigInteger.java:2501)
	at sun.security.rsa.RSACore.priCrypt(RSACore.java:150)
	at sun.security.rsa.RSACore.rsa(RSACore.java:124)
	at sun.security.rsa.RSASignature.engineSign(RSASignature.java:175)
	at java.security.Signature$Delegate.engineSign(Signature.java:1207)
	at java.security.Signature.sign(Signature.java:579)
	at org.terasology.identity.PrivateIdentityCertificate.sign(PrivateIdentityCertificate.java:71)
	at org.terasology.web.authentication.AuthenticationHandshakeHandlerTest.testBadSignature(AuthenticationHandshakeHandlerTest.java:77)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:19)
	... 22 more

I thought that the random generator was properly seeded to always produce the same numbers but looks like it isn't. This failure happened about 2 or 3 times in two months, always when I was working on completely separate classes from the one this code tests and I was just running all the tests before committing (which I do multiple times a day when I work on the server).

Expose server logs over REST API

Being able to view the contents of the server's logs could be helpful to remotely administrate the server. To do this, it should be possible to use the PathManager's getLogPath() method to find the logs directory, then get the contents of all .log files and expose them as a resource.

It might be best to restrict viewing of the logs to server admins.

Add secure WebSocket support and probably figure out some automated certificate approach

See https://forum.terasology.org/threads/facadeserver-headless-server-with-web-interface.1906/#post-15852 for some context. Might just be some Jetty option? @gianluca-nitti might know more / could figure it out

Ultimately this should allow us to https all the things - communication between this facade, its front-end running on http://utility.terasology.org:8000, the identity service also on http://utility.terasology.org (the default http port), and the meta server on http://meta.terasology.org (for modules)

For certificates likely auto-generate a self-signed cert for this facade and make it easy for the user to replace it with a legit one, like we could do for the instance hosted on utility.terasology.org

Better handling of command line arguments

A nice but still missing feature would be supporting the same command line arguments supported by the regular PC facade, like for example -overrideDefaultConfig.

Right now they are mostly managed by the PC facade itself, so a first step could be considering if it's the case to migrate some code from that class to the engine package to be able to reuse it for other facades (like Server) and avoid duplicating code.

NPE thrown when editing permissions

The following stack trace was reported to be shown in the server after removing the cheat permission from the web interface. The operation, anyway, was performed properly.
Looks like something related to notifying a client of an event, but needs further investigation.

15:59:17.420 [main] INFO  o.t.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts
15:59:24.800 [main] ERROR o.t.e.event.internal.EventSystemImpl - Failed to invoke event
java.lang.NullPointerException: null
	at org.terasology.web.resources.ResourceManager.onEvent(ResourceManager.java:179)
	at org.terasology.web.resources.base.RouterResource$1.onEvent(RouterResource.java:46)
	at org.terasology.web.resources.base.AbstractObservableResource.notifyEvent(AbstractObservableResource.java:38)
	at org.terasology.web.resources.console.ConsoleResource.onMessage(ConsoleResource.java:58)
	at org.terasology.web.resources.console.ConsoleResourceMethodAccess.invoke(Unknown Source)
	at org.terasology.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:531)
	at org.terasology.entitySystem.event.internal.EventSystemImpl.sendStandardEvent(EventSystemImpl.java:291)
	at org.terasology.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:282)
	at org.terasology.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:204)
	at org.terasology.logic.console.ConsoleImpl.execute(ConsoleImpl.java:250)
	at org.terasology.logic.console.ConsoleSystem.onCommand(ConsoleSystem.java:79)
	at org.terasology.logic.console.ConsoleSystemMethodAccess.invoke(Unknown Source)
	at org.terasology.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:531)
	at org.terasology.entitySystem.event.internal.EventSystemImpl.sendStandardEvent(EventSystemImpl.java:291)
	at org.terasology.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:282)
	at org.terasology.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:204)
	at org.terasology.network.internal.NetClient.processEvents(NetClient.java:533)
	at org.terasology.network.internal.NetClient.processReceivedMessages(NetClient.java:429)
	at org.terasology.network.internal.NetClient.update(NetClient.java:236)
	at org.terasology.network.internal.NetworkSystemImpl.update(NetworkSystemImpl.java:319)
	at org.terasology.engine.subsystem.common.NetworkSubsystem.preUpdate(NetworkSubsystem.java:52)
	at org.terasology.engine.TerasologyEngine.tick(TerasologyEngine.java:451)
	at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:421)
	at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:397)
	at org.terasology.web.EngineRunner.runEngine(EngineRunner.java:66)
	at org.terasology.web.ServerMain.main(ServerMain.java:119)
16:00:17.425 [main] INFO  o.t.p.i.ReadWriteStorageManager - Auto Saving - Creating game snapshot
16:00:17.427 [main] INFO  o.t.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.