matcracker / BedcoreProtect

BedcoreProtect is a fast, efficient, data logging and anti-griefing tool for PocketMine servers. Rollback and restore any amount of damage.
https://poggit.pmmp.io/p/BedcoreProtect/
GNU General Public License v3.0
43 stars 8 forks source link

High Resource Usage #12

Closed AlexPads closed 4 years ago

AlexPads commented 4 years ago

Issue description

OS and versions

Plugins

Crashdump, backtrace or other files

Screen Shot 12-23-19 at 12 33 AM

Extra

Tested on: CPU's:

Included for reference to show they are not like 1 core garbage CPU or Ram setups I have not looked into the plugin but i would assume that it has something to do with a loop getting stuck. or a really rapid listener.

matcracker commented 4 years ago

I'm trying to Windows 10 but I can't reproduce the issue. Do you change something in the configuration file?

AlexPads commented 4 years ago

Hello mat,

This is a config file from one of our customers experiencing this issue with our your plugin. It seems to be an issue that is only on Linux hosts i tried on Win10 and got no results but started up my Linux VM and got the same high CPU usage I also started it up on a Linux PC running Debian6 and got same High CPU.

# Plugin language
language: eng

# Database settings
database:
  # The database type. "sqlite" and "mysql" are supported.
  type: sqlite

  # Edit these settings only if you choose "sqlite".
  sqlite:
    # The file name of the database in the plugin data folder.
    # You can also put an absolute path here.
    file: bedcore_database.db
  # Edit these settings only if you choose "mysql".
  mysql:
    host: 127.0.0.1
    # Avoid using the "root" user for security reasons.
    username: root
    password: ""
    # The database name where plugin stores data.
    schema:
  # The maximum number of simultaneous SQL queries
  # Recommended: 1 for sqlite, 2 for MySQL. You may want to further increase this value if your MySQL connection is very slow.
  worker-limit: 1

# The timezone where you are located. This is necessary to correctly log the time of events.
# To find your timezone, check here: https://www.php.net/manual/en/timezones.php
timezone: "Europe/Lisbon"

# A list of worlds where the plugin can track logs
enabled-worlds: []

# If enabled, BedcoreProtect will check for updates when your server starts up.
# If an update is available, you'll be notified via your server console.
check-updates: true

# If no radius is specified in a rollback or restore, this value will be
# used as the radius. Set to "0" to disable automatically adding a radius.
default-radius: 10

# The maximum radius that can be used in a command. Set to "0" to disable.
# To run a rollback or restore without a radius, you can use "r:#global".
max-radius: 100

# If enabled, items taken from containers (etc) will be included in rollbacks.
rollback-items: true

# If enabled, entities, such as killed animals, will be included in rollbacks.
rollback-entities: true

# Logs blocks placed by players.
block-place: true

# Logs blocks broken by players.
block-break: true

# Logs blocks that break off of other blocks; for example, a sign or torch
# falling off of a dirt block that a player breaks.
natural-break: true

# Properly track block movement, such as sand or gravel falling.
block-movement: true

# Logs blocks that burn up in a fire.
block-burn: true

# Logs when a block naturally ignites, such as from fire spreading.
block-ignite: true

# Logs explosions, such as TNT and Creepers.
explosions: true

# Track when an entity changes a block, such as an Enderman destroying blocks. (NOT FULLY IMPLEMENTED IN POCKETMINE YET)
entity-change: true

# Logs killed entities, such as killed cows and enderman.
entity-kills: true

# Logs text on signs. If disabled, signs will be blank when rolled back.
sign-text: true

# Logs lava and water sources placed/removed by players who are using buckets.
buckets: true

# Logs natural tree leaves decay.
leaves-decay: true

# Logs tree growth. Trees are linked to the player who planted the sappling. (NOT IMPLEMENTED IN POCKETMINE YET)
tree-growth: true

# Logs mushroom growth. (NOT IMPLEMENTED IN POCKETMINE YET)
mushroom-growth: true

# Logs natural vine growth. (NOT IMPLEMENTED IN POCKETMINE YET)
vine-growth: true

# Logs water flow. If water destroys other blocks, such as torches,
# this allows it to be properly rolled back.
water-flow: true

# Logs lava flow. If lava destroys other blocks, such as torches,
# this allows it to be properly rolled back.
lava-flow: true

# Allows liquid to be properly tracked and linked to players.
# For example, if a player places water which flows and destroys torches,
# it can all be properly restored by rolling back that single player.
liquid-tracking: true

# Track item transactions, such as when a player takes items from a
# chest, furnace, or dispenser. Necessary for any item based rollbacks.
item-transactions: true

# Track player interactions, such as when a player opens a door, presses
# a button, or opens a chest. Player interactions can't be rolled back.
player-interactions: true

# Logs changes made via the plugin "BlockSniper" if it's in use on your server.
blocksniper-hook: false
matcracker commented 4 years ago

Hi Alex, this is the default plugin configuration. I will install VM based on Linux OS to try debug the problem. Give me some days because there is Christmas event.

Thank you!

matcracker commented 4 years ago

I reproduced the issue and... Yes, it only happens on linux OS. I need more time to debug it.

matcracker commented 4 years ago

Hi Alex, after some tests, I found the cause. It is caused from the library "libasynql" that manage the database. Unfortunately, I can't fix the issue because it does not depend from me. The library's author is already aware.

AlexPads commented 4 years ago

R.I.P

matcracker commented 4 years ago

Issue seems to be fixed now they made a new pull request, and its accepted now. poggit/libasynql#26

Yes, I have seen the new version of libasynql. I am currently working on a new version of BedcoreProtect v0.6.0 which aims to improve even more the performance and contains many bug fixes so far undiscovered! When I am in the final phase, I will try to update libasynql to v3.3 and do some tests.

matcracker commented 4 years ago

Hi @AlexPads and @enescaglayan, I am offering you a usable beta version of BedcoreProtect v0.6.0 to check if this issue persists. The version is stable but since it is a beta I advise you not to use it on a production server.

Please, let me know. Thanks in advance.