AsYetUntitled / Framework

Altis Life RPG mission framework for Arma 3 originally made by @TAWTonic.
Other
245 stars 308 forks source link

IS YOUR SERVER BROKEN SINCE 1.64 UPDATE? READ THIS #104

Closed BoGuu closed 7 years ago

BoGuu commented 8 years ago

Please make the changes from this commit: db66e545ef02faec2a2e9fd152eb5260b3deab8a, to your life_server/Functions/MySQL/fn_mresArray.sqf. If you use a headless client, change the relevant file in life_hc also.

Update:

If you have malformed entries in your DB (contains ``) then replace your mresToArray with the following:

http://hastebin.com/omikofajej.cpp

https://gist.github.com/BoGuu/c552b652f752378f06a42c809150032e

Over time they should fix themselves, and you can revert back to the original.

harmdhast commented 8 years ago

@angryfatty You didn't fixed the cop column. Check the integrity of the cop column or reset it to the default

"[]"
JedINyte commented 8 years ago

Running a 4.4 server (not r3) none of the fixes above fix the issue of spawning with no gear or licenses :( It initially works, but as soon as you leave the server and rejoin (lobby or server list) the columns re write the '' into the database.

BoGuu commented 8 years ago

@JedINyte Post your mres (array) functions, and a snap shot of your DB.

JedINyte commented 8 years ago

Hello Boguu, im fairly new to all this, never had to delve this deep into the database before: mresarray:

` /* File: fn_mresArray.sqf Author: Bryan "Tonic" Boardwine";

 Description:
 Acts as a mres (MySQL Real Escape) for arrays so they
 can be properly inserted into the database without causing
 any problems. The return method is 'hacky' but it's effective.

*/ private ["_array"]; _array = [_this,0,[],[[]]] call BIS_fnc_param; _array = str _array; _array = toArray(_array);

for "_i" from 0 to (count _array)-1 do { _sel = _array select _i; if ((_i != 0 && _i != ((count _array)-1))) then { if (_sel isEqualTo 34) then { _array set[_i,96]; }; }; };

str(toString(_array));`

mres to array:

`/ File: fn_mresToArray.sqf Author: Bryan "Tonic" Boardwine"; Description: Acts as a mres (MySQL Real Escape) for arrays so they can be properly inserted into the database without causing any problems. The return method is 'hacky' but it's effective. / private["_array"]; _array = [_this,0,"",[""]] call BIS_fnc_param; if (_array isEqualTo "") exitWith {[]}; _array = toArray(_array);

for "_i" from 0 to (count _array)-1 do { _sel = _array select _i; if (_sel == 96) then { _array set[_i,39]; }; };

_array = toString(_array); _array = call compile format["%1", _array]; _array;`

what do you mean by a snapshot of DB?

tkcjesse commented 8 years ago

I assume the ' at the start of that file and end on jedi is an attempt at markdown...

Also you guys need to make sure you're not doing the sql update while that player is on the server.... hope thats obvious...

tkcjesse commented 8 years ago

Hope we can all now learn why its important to test arma updates on a test instance and db prior to updating a live production server... and why doing a backup is necessary before hand.

JedINyte commented 8 years ago

The ' at the start and end is where i tried to add it as code on here lol (the little <> box)!! I thought it would put it in a neat box, but it just displayed as is with the' at each end. The player isn't on the server when updating the SQL :)

setoy commented 8 years ago

@boguu 4.4R3

Jawshy commented 8 years ago

If one is going to post code then please remember to format it. See Mastering Markdown → Examples → Code.

if (isAwesome){
  return true
}

If one is going to paste a lot of code then please upload it as a file to GitHub instead.

Jawshy commented 8 years ago

@JedINyte, one backtick ` is for single-line code. Three backticks ``` above and below are for multi-line code blocks. Hope that clears it up.

Gentism commented 8 years ago

im still having the issue with db after doing the mresarray fix anyone help??

harmdhast commented 8 years ago

@Gentism You need to fix your database as well. Either restore a backup or look for some little scripts in this issue thread.

TMschar commented 8 years ago

@rebornfuel as @tkcjesse said. Why it only works for seconds is because you still have players on your server while updating the MySQL entries.

Just shut your server down, update the tables and then connect and it will work. At least for that issue.

xProlithium commented 8 years ago

But we still haven't pinpointed the issue itself or what is causing it?

Jawshy commented 8 years ago

@xProlithium, str on the Bohemia Interactive Community Wiki:

... Since Arma 3 v1.63.137891 this command will correctly escape all " inside a string:

str command does not escape nested double-quotes for strings on the Bohemia Interactive Feedback Tracker.

TMschar commented 8 years ago

I just stumbled upon another issue and that is that as soon as you open your house crates everything and then log back in everything is gone.

See error log http://hastebin.com/xivobukafi.bash

Jawshy commented 8 years ago

@SimZor, it is the same issue; it is just affecting a different table.


Reference: https://github.com/AsYetUntitled/Framework/issues/81

xProlithium commented 8 years ago

I have an older version of tonic's mres so not only am I somewhat lost and how to fix it, I feel in the dark due to the version of the files as well.

Jawshy commented 8 years ago

@xProlithium, attach a copy of your fn_mresArray.sqf to a comment.

xProlithium commented 8 years ago

@Jawshy

private["_array"];
_array = [_this,0,[],[[]]] call BIS_fnc_param;
_array = str(str(_array));
_array = toArray(_array);

for "_i" from 0 to (count _array)-1 do
{
_sel = _array select _i;
if((_i != 0 && _i != ((count _array)-1))) then
{
if(_sel == 34) then
{
_array set[_i,96];
};
};
};

toString(_array);

When comparing mine to the one shown above, I saw very little difference, however when I overwrote it, I got an error in the insert

Jawshy commented 8 years ago

https://github.com/AsYetUntitled/Framework/issues/104#issuecomment-249102698

xProlithium commented 8 years ago

Better? I tried it the first time with ' and it didn't work lol

TMschar commented 8 years ago

@Jawshy so that means I can just do the DB fix for that table aswell?

setoy commented 8 years ago

I needed to fix the following columns in my DB:

containers: inventory gear

gangs: members

players: aliases civ_licenses cop_licenses med_licenses civ_gear cop_gear med_gear

vehicles: inventory gear

wanted wantedCrimes

Jawshy commented 8 years ago

@xProlithium,

private["_array"];
_array = [_this,0,[],[[]]] call BIS_fnc_param;
_array = str _array;
_array = toArray(_array);

for "_i" from 0 to (count _array)-1 do
{
_sel = _array select _i;
if((_i != 0 && _i != ((count _array)-1))) then
{
if(_sel == 34) then
{
_array set[_i,96];
};
};
};

str(toString(_array));
Jawshy commented 8 years ago

@SimZor, yes. See @setoy's comment above.

TMschar commented 8 years ago

There was no ´´ in my DB in any other tables than players, but yet it sometimes spits out the error.

@Jawshy

xProlithium commented 8 years ago

@Jawshy I'm getting an error in the asyncCall.sqf on line 53 and 56.

private["_queryStmt","_queryResult","_key","_mode","_return","_loop"];

_queryStmt = [_this,0,"",[""]] call BIS_fnc_param;
_mode = [_this,1,1,[0]] call BIS_fnc_param;
_multiarr = [_this,2,false,[false]] call BIS_fnc_param;

_key = "extDB2" callExtension format["%1:%2:%3",_mode,(call life_sql_id), _queryStmt];

if(_mode isEqualTo 1) exitWith {true};

_key = call compile format["%1",_key];
_key = _key select 1;

uiSleep (random .03);

_queryResult = "";
_loop = true;
while{_loop} do
{
    _queryResult = "extDB2" callExtension format["4:%1", _key];
    if (_queryResult isEqualTo "[5]") then {
        _queryResult = "";
        while{true} do {
            _pipe = "extDB2" callExtension format["5:%1", _key];
            if(_pipe isEqualTo "") exitWith {_loop = false};
            _queryResult = _queryResult + _pipe;
        };
    }
    else
    {
        if (_queryResult isEqualTo "[3]") then
        {
            uisleep 0.1;
        } else {
            _loop = false;
        };
    };
};
if(typeName _queryResult == "STRING") then {_queryResult = call compile _queryResult};

_return = (_queryResult select 1);

if(!_multiarr) then {
    _return = _return select 0;
} else {
    if((count (_return select 0)) == 0) then {_return = []};
};

_return;

Not sure what it refers to.

Line 53 is _return = (_queryResult select 1); and 56 is

if(!_multiarr) then {
    _return = _return select 0;
BartoCarto commented 8 years ago

I'm using 3.1.4.8 i have problem when players log out there gear is disappear after this update how i can solve this?

tkcjesse commented 8 years ago

Lmfaoooo. Omg.

TMschar commented 8 years ago

Is this troll?

Didn't they teach you to read in school?

tkcjesse commented 8 years ago

Dude HAS to be trolling. Holy fuck. Man this thread... lmao.

BoGuu commented 8 years ago

So is any one still broken?

Twisted123 commented 8 years ago

yes we are broken still

tkcjesse commented 8 years ago

So @BoGuu whats been the issues? Does this actually not fix it for some peoplem or is it bad db stuff after they've realized somethings broken?

BartoCarto commented 8 years ago

I've tried all the written ,Didn't work

mresArray http://pastebin.com/YD0UsEm5

mresToArray http://pastebin.com/9ZAR5XT7

Jawshy commented 8 years ago

https://github.com/AsYetUntitled/Framework/issues/104#issuecomment-249028317

https://github.com/AsYetUntitled/Framework/issues/104#issuecomment-249198252

@riskingfusion and @BartoCarto, your fn_mresArray.sqf file has not been updated with this change.

BoGuu commented 8 years ago

@Twisted123 Please post the files asked for, and a screenshot of your database (with recently logged in people)

@BartoCarto You haven't followed the one thing you were told to do in the OP

BartoCarto commented 8 years ago

i have made this change https://github.com/AsYetUntitled/Framework/commit/db66e545ef02faec2a2e9fd152eb5260b3deab8a

same problem

Jawshy commented 8 years ago

@BartoCarto, the fn_mresArray.sqf on the Pastebin file you linked does not have the latest change. The green highlight on the diff is the latest code.

Jawshy commented 8 years ago

If your database contains malformed entries then following the steps outlined in https://github.com/AsYetUntitled/Framework/issues/104#issue-178678747.

If you have malformed entries in your DB, run the following command:

UPDATE `players`
SET `civ_licenses` = replace(civ_licenses, '``', '`') where uid>=0;

Replace players and civ_licenses with relevant table/column (licenses, gear, containers etc etc.)

Or alternatively you can dump your DB, and find/replace ` ->, then reupload.

Twisted123 commented 8 years ago

Has this been fixed yet or anyone found a way to fix it?

BoGuu commented 8 years ago

@Twisted123 what exactly is your problem? You haven't posted any details about what your particular problem is, have you even made the changes stated?

numpty9989 commented 8 years ago

after running this "fix" got https://gyazo.com/478e2e9eb6cc58588a386e838e716690 any help would be appreciated

Emma-L commented 8 years ago

@numpty9989 Post a picture of your gear in the database

numpty9989 commented 8 years ago

https://gyazo.com/b13b6fad99b0f37dcb0e6d6e1a6ba3f0

Emma-L commented 8 years ago

@numpty9989 Please refer to the original post, which contains SQL to remove the malformed entries. (The double `` )

numpty9989 commented 8 years ago

me running query https://gyazo.com/709163b4ba3cd810f959a54e165181f2 me running it https://gyazo.com/2995b13a11d01eec3c0d6b5bbdb78e20 original time i did it said affected 24 rows

Emma-L commented 8 years ago

@numpty9989 'Replace players and civ_licenses with relevant table/column (licenses, gear, containers etc etc.)'

numpty9989 commented 8 years ago

huh