SideProjectGuys / invite-manager-bot

A discord bot that tracks invites and much more
https://docs.invitemanager.co/
GNU General Public License v3.0
166 stars 135 forks source link

Can't save configs (on private bot using this repo) #118

Closed chaun14 closed 5 years ago

chaun14 commented 5 years ago

I've setup a private bot using invitmanager's code. Basic commands as help, prefix, ping and tracking system are working well. When I try to setup somthing (!config leaveMessageChannel #mychannel) the bot with a freshly created databse send millions INSERT operations to the database but after few seconds the config is set. With an bigger and older database the bot send billions INSERT request until discord timed out or the memory allocated to nodejs allocated memory is overloaded and the script crash image

the begin of the unwanted operation: image

After reboot all configs are reset.

what i see in the console: https://i.imgur.com/9heQC6k.gifv

mariadb version: 10.2.26-MariaDB-10.2.26+maria~stretch innodb_version: 5.7.27 debian 9 node version: v11.15.0 npm version: 6.7.0

Is someting wrong in my server / bot configuration? thanks for your help :)

Valandur commented 5 years ago

The config object that the bot is inserting looks very wrong. It's supposed to be valid json, but that looks more like some kind of array converted to json. Does this happen with all config settings, or just the joinMessageChannel? I don't think those are millions of insert statements, just one really long one, but there's obviously something wrong.

chaun14 commented 5 years ago

it happend in all configurations with config and interactiveConfig commands

chaun14 commented 5 years ago

I am trying to use nodejs 10.16.3 but i got these error while connecting to discord image image image

chaun14 commented 5 years ago

for the error with Zlib just downgrade it to 0.1.4

chaun14 commented 5 years ago

i've try to run the bot with nodejs 10 but the same problem happen. It work fine with a new db but the problem restart at the second launch of the bot (configs are resetted)

Valandur commented 5 years ago

Can you try with mysql instead of mariadb? What character encoding is your database / the settings table / the value column in the settings table?

chaun14 commented 5 years ago

I can't install mysql-community-server on my vps. I've tried to use mariadb 10.3 but the problem happens. For the encoding I've kept it default

Valandur commented 5 years ago

I'm afraid I can't reproduce this issue. I tested with node 10.16.3 and everything works fine, on Windows 10 and Ubuntu 18.04.

chaun14 commented 5 years ago

What database server have you used for your test?

Valandur commented 5 years ago

MariaDB 10.4.7

Valandur commented 5 years ago

So I was able to reproduce this issue now, it is most certainly a MariaDB problem. The insert works for me, but also produces weird column data like the one that you showed. I believe it is related to this issue: https://github.com/sequelize/sequelize/issues/8702 that is fixed in sequelize v5, but this repo currently uses sequelize v4, and we are planning to switch to another ORM in the near future.

chaun14 commented 5 years ago

So for the official bot you are using mysql Community server?

Valandur commented 5 years ago

Yes exactly, version 5.7.27