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

[BUG] Default value issue after server crash #118

Closed
3 of 6 tasks
bblaha opened this issue May 4, 2020 · 3 comments
Closed
3 of 6 tasks

[BUG] Default value issue after server crash #118

bblaha opened this issue May 4, 2020 · 3 comments
Assignees
Labels
other:not_a_bug All bug reports that originally started as bugs, but ultimatelly turned out to be "something else". other:resolved All resolved issues that do not fall into any other category other All issues that do not have a specific category

Comments

@bblaha
Copy link
Contributor

bblaha commented May 4, 2020

Problem description

My server went down due to a short power outage. Once it was back up it threw a lot of errors, mostly in the direction of some field not having default values. Example:

Field 'Fleet_Array_Changes' doesn't have a default value

INSERT INTO _fleet_archive
(`Fleet_ID`, `Fleet_Owner`, `Fleet_Mission`, `Fleet_Array`, `Fleet_Time_Send`, `Fleet_Time_Start`, `Fleet_Time_Stay`, `Fleet_Time_End`, `Fleet_Start_ID`, `Fleet_Start_Galaxy`, `Fleet_Start_System`, `Fleet_Start_Planet`, `Fleet_Start_Type`, `Fleet_Start_Res_Metal`, `Fleet_Start_Res_Crystal`, `Fleet_Start_Res_Deuterium`, `Fleet_End_ID`, `Fleet_End_ID_Galaxy`, `Fleet_End_Galaxy`, `Fleet_End_System`, `Fleet_End_Planet`, `Fleet_End_Type`, `Fleet_End_Owner`, `Fleet_ACSID`, `Fleet_Info_HadSameIP_Ever`, `Fleet_Info_HadSameIP_Ever_Filtred`, `Fleet_Info_HadSameIP_OnSend`, `Fleet_Info_UsedTeleport`)
VALUES 
(525, 2, 4, '210,1', 1588597094, 1588597203, 0, 1588597312, 2, 1, 429, 7, 1, 0, 0, 0, '6', '6', 1, 322, 14, 1, '2', '0', false, false, false, 0) 

File: /fleet3.php
User: XXX[2]

The problem first appeared only on the overview.php site, by now it appears on every single site.

What I have tried:
Giving the fields causing the error (Fleet_Array_Changes, building_queue and some more) a default value of NULL. This solves the problem above, however after fleet_archive starts getting filled with NULL default entries for every fleet action I get an error because every insert into query is filled with "!noupt!", which is supposed to be this way according to FlyingFleetHandler.php
if($DataVal === null) { $DataVal = '"!noupd!"'; }
The error disappears when I delete all fleets from the database but occurs again, when fleets either Turn Back or arrive at their destination. After a while all pages show the error listed in the first place.

I can only imagine that the crash caused a query to be cancelled mid-execution, but I was not able to find a fix for it.

Engine details

  • Engine version:
    • version 1.0.0
  • Custom modifications:
    • Yes
    • No
  • Environment:
    • local
    • testing (inaccessible from the outside)
    • production (accessible from the outside world)
  • Configuration:
    • Game speeds
    • Debris settings
    • Any other relevant config entry

Steps to reproduce

Cannot reproduce, but cannot fix

Expected behavior

Fleets get sent correctly, building queues are handled correctly

Actual behavior

Error occurs on every page loaded

@bblaha bblaha added bug All bug reports bug:unconfirmed All new bug reports that are yet to be confirmed (eg. by providing more details) labels May 4, 2020
@bblaha bblaha changed the title [BUG] [BUG] Default value issue after server crash May 4, 2020
@mdziekon
Copy link
Owner

mdziekon commented May 4, 2020

I don't know how power outage could have affected your MySQL instance (that's a problem beyond this project's scope), but the SQL error you've pasted looks like the one mentioned in another issue: #41

If messing around with STRICT_TRANS_TABLES does not yield any results, and you didn't have this problem before, restoring from a backup sounds like the only solution.

@mdziekon
Copy link
Owner

mdziekon commented May 4, 2020

I also do not recommend adding any default values. As you've already noticed, it might break how the engine works. Unfortunatelly, there are some places where batch updates are packed in just a single query with a hackish method to do that. So, until I rewrite these batch updates to normal transactions, we're all stuck with these limitations mentioned in README.

@bblaha
Copy link
Contributor Author

bblaha commented May 4, 2020

I'm impressed, indeed for whatever reason the power outage re-activated STRICT_TRANS_TABLES.
I did not even think of that. De-activated it manually and now it works perfectly.
Thanks for your help!

@bblaha bblaha closed this as completed May 4, 2020
@mdziekon mdziekon added other:not_a_bug All bug reports that originally started as bugs, but ultimatelly turned out to be "something else". other:resolved All resolved issues that do not fall into any other category other All issues that do not have a specific category and removed bug All bug reports bug:unconfirmed All new bug reports that are yet to be confirmed (eg. by providing more details) labels May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
other:not_a_bug All bug reports that originally started as bugs, but ultimatelly turned out to be "something else". other:resolved All resolved issues that do not fall into any other category other All issues that do not have a specific category
Projects
None yet
Development

No branches or pull requests

2 participants