COMMITTED: UCS crash fix
Okay, I think it makes sense to post my fix here, since my UCS isnt crashing anymore.
Quote:
|
Sounds good to me. I will give it a shot and commit it when I have a few minutes. Thanks for the submission!
|
Sure thing, happy to contribute to this project.
|
My UCS has been running for 24+ hours now after this change. (Windows server)
|
Shouldn't you just return false, then initialize the mysql connection after that if it is false? That makes more sense to me.
|
I guess youre right regarding the return false. With my quick and dirty fix you may not get any database error messages again (some may think thats a good thing though LOL).
But on the other hand that way its possible that the UCS will just quit clean after it encounters a database error. I am not sure about that. I would leave init where it is, since its the only place where the mysql struct gets closed (except in the destructor), so theres no reason to call it elsewhere. |
I think what he may be saying is that instead of closing mysql, return false instead? Then the connection wouldn't need to be re-initialized.
|
came down to my office and looked at the PC running my test server and noticed that UCS crashed over night. :(
|
Were any players on during that time?
|
Not when i came down no. It is mainly just used by me to test things.
I had toons in and out yesterday most of the day and it was running. Went to bed early and when i came down to my office this morning UCS was crashed. UCS only crashes on a new log in that I've noticed, but then the times that I've seen it actually crash were when I logged in a toon after being offline for hours and no one else had logged in during the interim. I restarted the UCS right when I seen it crashed this morning and I have had a couple toons in and out of my server this afternoon and it hasn't crashed again yet. |
My UCS is running in visual studio debug mode all of the time. Got a database error actually today, but no crash.
|
I analyzed the UCS code a bit further and I am now 99.99% ;) sure that my fix is the way it is supposed to be.
When the function dbcore::RunQuery() results in a connection/database error, it is calling itself again for exactly 1 retry, but on that 2nd call it checks for the status. If pStatus = error then dbcore::Open() is called. Open() calls mysql_close() on any error status and is supposed to reconnect in the same call, but will definitetely fail without mysql_init(). So placing a FALSE after the "close" or "init" would prevent Open() to reconnect. All that is missing now is a confirmation message, that the recovery of the encountered error was successful. Code:
bool DBcore::RunQuery(const char* query, int32 querylen, char* errbuf, MYSQL_RES** result, int32* affected_rows, int32* last_insert_id, int32* errnum, bool retry) { |
Looked at my server this morning and the chat service was still running. Looked at the character_ table and it look like only a single random toon signed on after the last time I was on.
I started my client and connected. As soon I clicked enter world the UCS crashed. With the standard WIndows XP please report dialog box. In the command window: Code:
Database Error: Lost connection, attempting to recover.... Code:
Character TimeLastOn |
Aye, thats the error I encountered last time, but for me it doesnt crash, it actually recovers now.
|
Looked at my build again and found an error on my side. When I added the mysql_init I had a syntax error. Rebuilt and restarted.
|
All times are GMT -4. The time now is 12:05 AM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.