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

crash when attempting to sync inventory with unsupported items #18

Closed
vfreex opened this issue Jun 18, 2017 · 6 comments
Closed

crash when attempting to sync inventory with unsupported items #18

vfreex opened this issue Jun 18, 2017 · 6 comments
Assignees
Labels
Milestone

Comments

@vfreex
Copy link

vfreex commented Jun 18, 2017

Issue Description:

I have 2 sponge servers. One is moded, while the other is original.
If a player keeps items extended by mods then switch to the original server, InvSync will crash and out-of-sync.

  • Minecraft: 1.11.2
  • InvSync: 0.6.14
  • Sponge: 1.10.2-2281-5.2.0-BETA-2394
  • Other related mods:
    forge-1.10.2-12.18.3.2281
    ThermalExpansion-1.10.2-5.1.3.4

Your most recent log or stack trace file where the issue was present:

[18:18:24 ERROR] [Sponge]: The Scheduler tried to run the task invsync-S-2 owned by Plugin{id=invsync, name=Inventory Sync, version=0.6.14, description=This plugin synchronizes the player inventory with a database, url=https://github.com/BrainStone/InvSync, authors=[The_BrainStone], source=mods/InvSync-0.6.14.jar}, but an error occured.
java.util.NoSuchElementException: No value present
        at java.util.Optional.get(Optional.java:135) ~[?:1.8.0_131]
        at org.spongepowered.common.item.inventory.SpongeItemStackBuilder.fromContainer(SpongeItemStackBuilder.java:168) ~[SpongeItemStackBuilder.class:1.10.2-5.2.0-BETA-387]
        at world.jnc.invsync.util.serializer.InventorySerializer.deserializeItemStack(InventorySerializer.java:79) ~[InventorySerializer.class:0.6.14]
        at world.jnc.invsync.util.serializer.InventorySerializer.deserializeInventory(InventorySerializer.java:56) ~[InventorySerializer.class:0.6.14]
        at world.jnc.invsync.util.serializer.PlayerSerializer.deserializePlayer(PlayerSerializer.java:133) ~[PlayerSerializer.class:0.6.14]
        at world.jnc.invsync.event.PlayerEvents.loadPlayer(PlayerEvents.java:154) ~[PlayerEvents.class:0.6.14]
        at world.jnc.invsync.event.PlayerEvents.access$200(PlayerEvents.java:33) ~[PlayerEvents.class:0.6.14]
        at world.jnc.invsync.event.PlayerEvents$WaitingForPreviousServerToFinish.accept(PlayerEvents.java:194) ~[PlayerEvents$WaitingForPreviousServerToFinish.class:0.6.14]
        at world.jnc.invsync.event.PlayerEvents$WaitingForPreviousServerToFinish.accept(PlayerEvents.java:166) ~[PlayerEvents$WaitingForPreviousServerToFinish.class:0.6.14]
        at org.spongepowered.common.scheduler.SchedulerBase.lambda$startTask$0(SchedulerBase.java:183) ~[SchedulerBase.class:1.10.2-5.2.0-BETA-387]
        at org.spongepowered.common.scheduler.SyncScheduler.executeTaskRunnable(SyncScheduler.java:81) ~[SyncScheduler.class:1.10.2-5.2.0-BETA-387]
        at org.spongepowered.common.scheduler.SchedulerBase.startTask(SchedulerBase.java:179) ~[SchedulerBase.class:1.10.2-5.2.0-BETA-387]
        at org.spongepowered.common.scheduler.SchedulerBase.processTask(SchedulerBase.java:165) ~[SchedulerBase.class:1.10.2-5.2.0-BETA-387]
        at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707) [?:1.8.0_131]
        at org.spongepowered.common.scheduler.SchedulerBase.runTick(SchedulerBase.java:108) [SchedulerBase.class:1.10.2-5.2.0-BETA-387]
        at org.spongepowered.common.scheduler.SyncScheduler.tick(SyncScheduler.java:51) [SyncScheduler.class:1.10.2-5.2.0-BETA-387]
        at org.spongepowered.common.scheduler.SpongeScheduler.tickSyncScheduler(SpongeScheduler.java:191) [SpongeScheduler.class:1.10.2-5.2.0-BETA-387]
        at net.minecraft.server.dedicated.DedicatedServer.handler$onTick$zob000(SourceFile:1253) [ld.class:?]
        at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(SourceFile:340) [ld.class:?]
        at net.minecraft.server.MinecraftServer.func_71217_p(SourceFile:554) [MinecraftServer.class:?]
        at net.minecraft.server.MinecraftServer.run(SourceFile:458) [MinecraftServer.class:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]

Is there any possibility to avoid this kind of crash and block unsupported items?

@BrainStone
Copy link
Member

I'm not sure what I could do about it. Sure I could catch the exception. But that would mean that all unsupported items would be deleted.
The plugin is not designed to be used on different modpacks

@vfreex
Copy link
Author

vfreex commented Jun 18, 2017

Is there a placeholder for unsupported items?
I know sync items between different modpacks or Minecraft versions is not easy. At the present time I only uses Ender chests to sync between those different kinds of servers, so deleting unsupported items may be a feasible choice. Maybe adding an option to let users make the decision whether to delete unsupported items?

@BrainStone
Copy link
Member

Well, ok. I'll make sure that unsupported items will just get deleted. I can't really make that an option tbh

@vfreex
Copy link
Author

vfreex commented Jun 18, 2017

Thanks for your quick response.
Just another idea: When fail to add an item, move it to a temporary collection rather than delete it. So we can move all items in the temporary collection back when the user is leaving the world.

@BrainStone
Copy link
Member

Oh boy. That is more complicated than you imagine. Alone storing it is a hassle. Let alone all the corner cases like the former slot is now occupied, your the container doesn't have any free slots...

@BrainStone BrainStone self-assigned this Jun 18, 2017
@BrainStone BrainStone added the bug label Jun 18, 2017
@BrainStone
Copy link
Member

You can follow #19

@BrainStone BrainStone added this to the 1.0.0 milestone Jun 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants