Shopkeepers

Shopkeepers

2M Downloads

Shops Duplicating

blablubbabcDEV opened this issue ยท 19 comments

commented

Migrated from: https://dev.bukkit.org/projects/shopkeepers/issues/268

Originally posted by 2toetommy (Dec 3, 2014):

What steps will reproduce the problem?
1.Use any version of Shopkeepers plugin
2.Make trade shops (I used commands)
3.Restart server or is server timed outWhat is the expected output? What do you see instead?
I expect the plugin to reload with correct amount of shops that are interactable.
I get doubles of all shops that are normal AI and cant interact with them at all. They all have the shop tags alsoWhat version of the product are you using?
Tested on last 4 versionsDo you have an error log of what happened?
No error is thrown in consol or logs. just dups shops.Please provide any additional information below.

commented

Originally commented by blablubbabc (Dec 3, 2014):

Which server version are you using? I asume you are using spigot 1.8?
I think to remember that I had some duplicated shops as well one time during testing, but since then I could reproduce it anymore.. Reloads, crashes, server stops/restarts.. Currently I can't seem to get it duplicating.. Under which exact circumstance do they duplicate for you?

        Edited Dec 3, 2014
commented

Originally commented by 2toetommy (Dec 3, 2014):

[at]blablubbabc:
I am using Bukkit 1.7.9.
Any time the server times out or forced restart (not my choosing) most recently had a plugin that defaulted to checking for votes every 2 secs ... IDK why a dev would do that... but it was timing out the server. When I cam back on, doubles of all the spawn shops (only place there is shops atm)
This has happend with simular issues when server crashes and one time when doing a normal restart.

commented

Originally commented by blablubbabc (Dec 3, 2014):

[at]2toetommy:
The plugin already has something built-in which tries to find and reuse old villager entities when it loads shops.

I tried crashing my local test server as well (killing the process), but wasn't yet able to reproduce this again. So that reusing of old villager entities seems to work, at least most of the time. Though I had the duplicated villagers as well once during my 1.8 testings.

I keep testing around.

commented

Originally commented by 2toetommy (Dec 10, 2014):

Current bukkit 1.7.10, Issue resolved. Was bad config on votifier timing out server that was causing issue with plugins reading in proper time.
So not your side at all.

commented

Originally commented by 2toetommy (Dec 10, 2014):

Thank you for your looking into this issue so fast and working on it for us.

commented

Originally commented by blablubbabc (Dec 10, 2014):

[at]2toetommy:
I am still observating the duplicating i had during 1.8 testings.

commented

Originally commented by 2toetommy (Dec 3, 2014):

[at]blablubbabc:
Ill try a few things on my side. in last 30days its happend 3 times. so ill let oyu know hwat I find.

commented

Originally commented by 2toetommy (Dec 6, 2014):

I wanted to update you on what I have found so far.
I have turned on Spawn verify -
Ever sense this no duplicating of shops has happen.
I want to say this may be more of a minecraft / plugin issue not really on your side. What I can tell is that If Verify spawn is off and your really Lag out the server and it times out It can Dup shops. It seems that this is probly Bukkit side rather then on your plugin.
Resons:
Duped shops have default tag color - I have changed mine to Orange the duped shops are green. So it seems that the bukkit is duping them when time out is hapening. So easy fix. Use spawn verify.

commented

Originally commented by tk11 (Dec 12, 2014):

[at]blablubbabc:
Yes I am. On my server, if I reload enough times I get an OOM PermGen space error and have to restart the server. When it comes back up, I have duplicate villagers. This is forcing the bug, but it has occurred since I was on CB 1.7.9 when I do not recall ever having the OOM error. (The OOM error may be coming from simply reloading many times with a bunch of plugins, or one (or more) may have mem leaks - possibly ProtocolLib. I am still trying to track it down.)
I am hosted on BeastNode with 3GB RAM (Creeper) and these are my current plugins (all newest, updated versions):

AdminMode (new plugin, issue occurred before this)

AreaShop

Chairs

ColoredAnvils (new plugin, issue occurred before this)

CreateYourOwnMenus

Essentials

EssentialsAntiBuild

EssentialsChat

EssentialsGroupManager

EssentialsProtect

EssentialsSpawn

GiveAll (new plugin, issue occurred before this)

Gringotts

Highway (new plugin, issue occurred before this)

Interactables

Jobs (new plugin, issue occurred before this)

Multiverse-Core

PortalCommands

ProtocolLib (new plugin, issue occurred before this)

ServerListPlus (new plugin, issue occurred before this)

ShopKeepers

TitleManager (new plugin, issue occurred before this)

TrashIt (new plugin, issue occurred before this)

VanishNoPacket

Vault

WorldBorder

WorldEdit

WorldGuard
Let me know if you want any more information that could help. This is an awesome plugin and we really want to use it. We considered making a game out of it and letting players kill the clones for prizes if they find them roaming around.

commented

Originally commented by blablubbabc (Dec 17, 2014):

I think this issue is in some way related to server crashes after a shopkeeper entity was just respawned (for example after a reload):
the world data still has an old shopkeeper entity saved on disk
the plugins removed that entity and spawned a new one (during reload for example)
the plugin gets to save the new entities uuid (which we use to prevent duplicate shop entities in other/similar situations): for example in the time between multiple reloads in a row.
server crashes without another world save since the new entity was spawned
server gets restarted, and the plugin checks for an old entity in the world (via the uuid we saved): however the entity saved to world wasn't the last entity we spawned and remembered -> new entity gets spawned and we now have duplicated entities

During my testings I was able to fix this issue by constantly saving the world and shopkeeper data everytime right after a new shop entity got spawned. This however is no good solution for a public server where lots of shop entities constantly get respawned.
The best solution would probably be to prevent minecraft from storing the shop entities to disk all together. This however would currently involve maintaining custom entity classes for each entitiy we want to support, similar to how npc plugins like citizens do it.
A potential alternative would be to keep a list of past entity uuid's, which we use to identify the old entity in the world. However I am currently still thinking about when it's best to forget about entity uuids / when we can be sure that the current active entity was stored to disk, so we can forget about older uuid's. Bukkit's WorldSaveEvent seems a good candidate for this, however there seem to be some situtions (ex. save command) were it doesn't get called.

        Edited Dec 17, 2014
commented

Originally commented by tk11 (Dec 17, 2014):

[at]blablubbabc:
Thanks for the info. I was going to ask if you considered SQL support, possibly for tracking, then I see that it is listed on the repo as a TODO. If I get time and you do not mind, I may take a look at the source and see about working on something.

commented

Originally commented by tk11 (Dec 12, 2014):

So this is still an issue, correct? I just migrated from CB 1.7.9 to Spigot 1.8 with the newest version of Shopkeepers, and I am still getting instances of villager duplication.
It seems to occur when there are a number of reloads and/or restarts. I am still building my server and making a lot of changes, so I do not have any spawned currently.

commented

Originally commented by blablubbabc (Dec 12, 2014):

[at]tk11:
Are you able to reliable reproduce this issue? I tried spamming server reloads and restarts but am not able to reproduce this. I only had the duplication issue two times now without knowing the exact context.

commented

Originally commented by blablubbabc (Mar 22, 2016):

I am doing another attempt on this issue: The next release v1.71 will contain the following change:

Whenever the world gets saved (at least whenever the WorldSaveEvent is triggered by bukkit, which also seems to be the case now when saving via the save-all command) the plugin temporarily unloads all shopkeeper entities (open windows (trading, editor, hiring, etc.) will be kept open though, as I don't see a problem with that right now). Shortly after the world was saved, the shop entities get loaded again in the world.
This seemed to work during my testings, in which I:
Saved the world via /save-all.
Then triggered a few shopkeeper reloads, so that the spawned entity differs from the one which usually would have gotten saved to disk (should no longer get saved to disk with this change).
Modified a trade so all shopkeeper data gets saved to disk.
'Crashed' the server by killing the server process.

No duplicated entities were found in this tested scenario.

Though, as I don't know for sure that this scenario was really the issue here, it would be useful for me if somebody who had problems with this in the past could test this out and confirm me that this is no longer an issue for them as well.

commented

Originally commented by blablubbabc (Apr 8, 2016):

v1.71 was released. I will close this ticket for now. If this issue is still present, please create a new ticket, preferably with further information on the circumstances.

commented

Originally commented by KreatorB (Sep 1, 2015):

Hello, I am running a 1.8.7 Mini-server and I have this same issue mainly when crashes occur. it seems if I am doing something that overloads the ticks or pasting large block sizes I get a time out the server restarts like a crash and it cause dups to reload in the same areas as the shopkeepers. the dups are not shopkeeper in fact they are true villagers except the look and have the name of the shop keepers. can one of the following configs help with this issue?
disable-other-villagers: false
hire-other-villagers: false
block-villager-spawns: false
enable-spawn-verifier: false
bypass-spawn-blocking: true
bypass-shop-interaction-blocking: true

I ask cause in my mini-game server I also have a survival world and it requires the villagers to be on.
One other thing, do you think if I go into the save file am manually change the shopkeepers to like zombies, witches, etc.. it would spawn those mobs in place with name?
Please help thanks

        Edited Sep 1, 2015
commented

Originally commented by blablubbabc (Sep 1, 2015):

[at]KreatorB:
Quote:can one of the following configs help with this issue?

I doubt that those settings change anything on this issue.
Quote:One other thing, do you think if I go into the save file am manually change the shopkeepers to like zombies, witches, etc.. it would spawn those mobs in place with name?

Yes, if you change the shopkeeper entity types in the save file, those entities will get spawned instead. Though manually modifying the save file is not officially supported.

commented

Originally commented by der_Kernschatten (Mar 15, 2016):

I remember this issue from years ago during the days of nisovin then (I believe, CubeNation).
It is still happening today in the latest 1.9 Spigot.
I believe blablubbabc's assessment of crashes/hangs being a trigger is a possibility, since I had some crashes using a special world generator.
I'm leaning towards using Creepers/Zombies/Witches as a possible solution because I don't want to deal with this after bringing my server back to Vanilla post-Bukkit-debacle, and recently deciding to go back to plugins and such.

commented

Originally closed by blablubbabc (Apr 8, 2016)