ID:75769
 
Resolved
Fixed in 444
BYOND Version:443
Operating System:Windows Vista Business 64-bit
Web Browser:Firefox 3.0.11
Status: Resolved (444)

This issue has been resolved.
Descriptive Problem Summary:
After updating BYOND this morning, one of my projects began crashing immediately upon load. I have determined that the issue is MySQL-related; I use a MySQL saving system, and the character queries are crashing the game at start-up.

I believe the problem is related to my calls to Dantom.DB's GetRowData() function, though I am calling it indirectly through Alathon's SimpleMySQL library.

Calling GetRowData() on my database crashes both Seeker and Daemon, on at least two separate database tables. There is a copy of the same game, compiled yesterday, running on a Unix server right now, and it has no problem accessing the same database. If I disable GetRowData() to prevent the crash, I do not receive any errors on the query itself.

Code Snippet to Reproduce Problem:
    var/DBQuery/DQ = mysql.CreateQuery()
if(istype(DQ,/DBQuery))
DQ.Execute(SQLFormat_Select(TABLENAME,"*","WHERE ownerkey = '[ownerkey]'"))
while(DQ.NextRow())
var/list/column_data = DQ.GetRowData()
else
world.log << DQ
mysql.dbcon.Connect(mysql.DBI(), mysql.DBUser(), mysql.DBPass())
world.log << mysql.dbcon.ErrorMsg()


Expected Results:
GetRowData() retrieves character information from a DBQuery object.

Actual Results:
The game crashes.

When does the problem occur?
The problem occurs any time that there is at least one row of data to retrieve. This has been replicated on another computer (Windows 7 RC1).

When does the problem NOT occur?
When I disable MySQL access.

Workarounds:
Not using MySQL.

[Edit note: I trimmed the code down to the most important elements]
A few questions:

1) Did this happen in version 442?

2) What version are you running on unix? If it is not 443, it would help to know if it crashes in unix 443.
Tom wrote:
A few questions:

1) Did this happen in version 442?

Nope, it started happening just after I updated this morning; nothing had significantly changed since I last worked on and ran the project last night.

2) What version are you running on unix? If it is not 443, it would help to know if it crashes in unix 443.

I'm not certain what version it is, but I know it isn't 443. I can go ahead and try it, though. I guess it's actually an Ubuntu server. I'll get back to you on this in a little bit.
I was unable to reproduce this on my system, but as there was a change in the DB access, it's not shocking that we're having an issue now.

What version of sql are you running?
The shell server doesn't seem to be having any problems with the update; it can run both yesterday and today's copies just fine.

I just did another, cleaner reinstall of the latest version on my Windows machine without any luck. Interestingly, I downloaded the copy of the game that I put on the server yesterday (compiled with 442), and it has the same issue running under 443 in Windows.

MySQL version is 5.0.51a.
Can you provide a zip file with a working demo of the issue? Because your snippet uses external libraries, I had to edit it to get it to work. It would be best to test a case that I know for certain is crashing your machine.
My game has the same problem in the new version also(my game wont even run in 443). I created a new environment and added a simple select statement that uses GetRowData(). Then I put it inside of world/New() and when I run the world the dreamseeker will not even open. Next I tried putting the select statement inside of client/New(), the dreamseeker does launch, but it does nothing after that.

Host OS: Vista Ultimate
Database OS: Ubuntu 9.04
MySql Version: 5.1.31

Edit: The same simple select statement does, however, work fine inside of a verb.

Well, I've been trying to put together a demo for awhile now, but I can't seem to replicate it exactly.

I wrote two simplified functions to create a table, feed it some dummy info, and then select that info for display. One function used Alathon's library like the rest of my code, the other only uses Dantom.DB. Both caused my game to crash.

Then I moved the two functions into their own project: http://www.byond.com/members/LordRaven/files/ MySQL%20Problem_src.zip

They don't cause it to crash, but they still don't behave quite right. The first time you run either one, it stops at GetRowData(), indicating that it found something, but fails during the retrieval. For some reason, it works the next time it is called. (Sorry, I wasn't kind enough to include credentials for a database of my own, so you'll have to plug that stuff in)

Maybe I'm doing something wrong, but it was working fine for me until today.

If you'd like to see if the game itself crashes for you, here is an empty version with character creation, just make a character, then load it up again and see if it crashes: http://www.byond.com/members/LordRaven/files/ Dream%20Forge.zip
I am not seeing the problem in the demo you created (I'm also on 5.0.51a). I created a table with two rows and it retrieved the data correctly.

DreamForge gave me lots of errors, but I can't imagine it'll work since it doesn't have access to my db info anyway.

I'll keep digging around for incompatibilities. I'm not sure why the new change affected this though; it may have only been coincidence that it was working before.
Tom wrote:
I am not seeing the problem in the demo you created (I'm also on 5.0.51a). I created a table with two rows and it retrieved the data correctly.

But that demo itself was sound? It created the table, added the data, and retrieved it successfully on its own? The first time? Because if that worked for you, then I can't imagine what is wrong on my end.

DreamForge gave me lots of errors, but I can't imagine it'll work since it doesn't have access to my db info anyway.

Dream Forge should still have access to my database; what sort of errors did it give you? It should only crash after you've created a character once and rebooted, as otherwise, it never reaches that GetRowData() because there are no results for the select.

I'll keep digging around for incompatibilities. I'm not sure why the new change affected this though; it may have only been coincidence that it was working before.

This is exactly what I was worried about; as I'm no expert at MySQL, I thought maybe it was just luck driving my saving system this entire time, but if other people can run the Dream Forge demo there (after making a character), then it's definitely something with my installation, and not my game or the database. I'll get some other people to try it.
Lord Raven wrote:
But that demo itself was sound? It created the table, added the data, and retrieved it successfully on its own? The first time? Because if that worked for you, then I can't imagine what is wrong on my end.

Yes, when I run either demo for the first time (nonexistent table "databasetest"), I get the output:
Found something.
Hello

I updated it to add multiple rows and it correctly output those.

Dream Forge should still have access to my database; what sort of errors did it give you? It should only crash after you've created a character once and rebooted, as otherwise, it never reaches that GetRowData() because there are no results for the select.

Ah, I didn't realize it was using a remote database. I'll try it again. I got a lot of proc errors but I may have done something wrong the first time.
I have verified the problem. Oddly, it was not occurring in my debug build, which is why I didn't see it before. I'll figure out what's up and provide a patch ASAP.
I've taken the liberty of releasing 443.1023 (at the download page) that also contains the fix. Please test it and verify that all is kosher.
It is fixed; thank you!