MovingBlocks / Terasology

Terasology - open source voxel world
http://terasology.org
Apache License 2.0
3.69k stars 1.34k forks source link

AccessControlException on triggering game SFX in multiplayer #3781

Closed Cervator closed 4 years ago

Cervator commented 5 years ago

What you were trying to do

Playtest! Break stuff. As in, physically breaking blocks and things in-game

What actually happened

No breakage :( Various consequences like blocks not breaking yet dropping stuff

Turns out several different paths that lead to sound triggering events in multiplayer cause an access exception. That was ending handling of block breaking because the SFX step failed.

After commenting out just the SFX related stuff I could proceed normally.

However! While at first I reproduced this locally the play test server later no longer triggered the issue. Then later did it again. Then not again? I tried it again locally on a totally different system and reproduced it with perfect consistency. I don't know what happened during the play test that lead to mysterious results - maybe a combination of player logins and logoffs? Sometimes blocks were breaking yet remained visible. Server log had more similar errors.

How to reproduce

Three spots where I triggered it and uncommented lines to make it go away (triggered via simple block breaking and picking up the drops):

Log details and game version

Latest develop as of this writing, both via binary and source. This example comes from the player character taking damage and attempting to play the associated SFX.

11:25:47.599 [main] ERROR o.t.e.event.internal.EventSystemImpl - Failed to invoke event
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getProtectionDomain")
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
    at java.security.AccessController.checkPermission(AccessController.java:884)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    at org.terasology.module.sandbox.ModuleSecurityManager.checkPermission(ModuleSecurityManager.java:49)
    at java.lang.Class.getProtectionDomain(Class.java:2299)
    at org.terasology.module.ModuleEnvironment.getModuleProviding(ModuleEnvironment.java:297)
    at org.terasology.persistence.typeHandling.reflection.ModuleEnvironmentSandbox.getModuleProviding(ModuleEnvironmentSandbox.java:170)
    at org.terasology.persistence.typeHandling.reflection.ModuleEnvironmentSandbox.isValidTypeHandlerDeclaration(ModuleEnvironmentSandbox.java:132)
    at org.terasology.persistence.typeHandling.TypeHandlerLibrary.getTypeHandler(TypeHandlerLibrary.java:375)
    at org.terasology.persistence.typeHandling.TypeHandlerLibrary.getTypeHandler(TypeHandlerLibrary.java:307)
    at org.terasology.persistence.typeHandling.TypeHandlerLibrary.getFieldHandlerMap(TypeHandlerLibrary.java:413)
    at org.terasology.persistence.typeHandling.TypeHandlerLibrary.getSerializerFor(TypeHandlerLibrary.java:213)
    at org.terasology.persistence.serializers.EventSerializer.serialize(EventSerializer.java:132)
    at org.terasology.network.internal.NetClient.send(NetClient.java:355)
    at org.terasology.entitySystem.event.internal.EventSystemImpl.sendEventToOwner(EventSystemImpl.java:344)
    at org.terasology.entitySystem.event.internal.EventSystemImpl.networkReplicate(EventSystemImpl.java:318)
    at org.terasology.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:273)
    at org.terasology.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:205)
    at org.terasology.logic.health.DamageAuthoritySystem.onDamaged(DamageAuthoritySystem.java:167)
    at org.terasology.logic.health.DamageAuthoritySystemMethodAccess.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:205)
    at org.terasology.logic.health.DamageAuthoritySystem.doDamage(DamageAuthoritySystem.java:109)
    at org.terasology.logic.health.DamageAuthoritySystem.checkDamage(DamageAuthoritySystem.java:136)
    at org.terasology.logic.health.DamageAuthoritySystem.onDamage(DamageAuthoritySystem.java:124)
    at org.terasology.logic.health.DamageAuthoritySystemMethodAccess.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:205)
    at org.terasology.thirst.ThirstAuthoritySystem.onPeriodicActionTriggered(ThirstAuthoritySystem.java:107)
    at org.terasology.thirst.ThirstAuthoritySystemMethodAccess.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:205)
    at org.terasology.logic.delay.DelayedActionSystem.lambda$invokePeriodicOperations$1(DelayedActionSystem.java:127)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1235)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.terasology.logic.delay.DelayedActionSystem.invokePeriodicOperations(DelayedActionSystem.java:114)
    at org.terasology.logic.delay.DelayedActionSystem.update(DelayedActionSystem.java:63)
    at org.terasology.engine.modes.StateIngame.update(StateIngame.java:171)
    at org.terasology.engine.TerasologyEngine.tick(TerasologyEngine.java:462)
    at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:425)
    at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:401)
    at org.terasology.engine.Terasology.main(Terasology.java:145)
11:25:47.652 [main] INFO  o.t.p.i.ReadWriteStorageManager - Auto Saving - Creating game snapshot
DarkWeird commented 4 years ago

Method org.terasology.module.ModuleEnvironment#getModuleProviding at (ModuleEnvironment.java:297) was rewrite in gestalt's develop branch by PR: https://github.com/MovingBlocks/gestalt/pull/68

And cannot throw access denied. Can we update gestalt?

Cervator commented 4 years ago

Closing as fixed by #3791 :-)

DarkWeird commented 4 years ago

@Cervator it's possible fix! :(