tmysql4 - A multi-connection version of tmysql3 (Now with mysqloo wrapper!)
384 replies, posted
Try again. Seems github had a little outage but is back now.
Still nothing...
I even reinstalled my os, and ran steamcmd and what not through root instead of a secondary user.
[code]root@alex:~/gmod/garrysmod/lua/bin# ldd gmsv_tmysql4_linux.dll
./gmsv_tmysql4_linux.dll: /usr/lib32/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./gmsv_tmysql4_linux.dll)
linux-gate.so.1 (0xeb286000)
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xead8a000)
libm.so.6 => /lib32/libm.so.6 (0xead44000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xead27000)
libc.so.6 => /lib32/libc.so.6 (0xeab7d000)
/lib/ld-linux.so.2 (0xeb287000)
[/code]
I'm assuming I need this glib thing?
Okay okay so. I just compiled the module with Debian Wheezy 7. I checked the strings on it and it will need GLIBCXX_3.4.11 which should definitely be old enough.
[url]https://github.com/blackawps/gm_tmysql4/raw/master/lib/linux/libgm_tmysql4.so[/url]
Rename it to gmsv_tmysq4_linux.dll and please tell me if it works. I really really think I fixed the issue once and for all, but I could be wrong.
A friend of mine is in the process of converting from mysqloo > tmysql4, however it seems the wrapper he's using as the intermediary for the time being is throwing the error "Malformed packet" when trying to connect. It wasn't doing this previously with mysqloo and to my knowledge the charset is correct. Any thoughts?
Edit: Scratch that, turns out they were using mysql 5.0 with legacy connections. Now upgraded to 5.5 and all is well.
Would it be possible to add a function to bind what IP it uses to connect? Right now if the IP it uses goes offline there's no way to make it chose an online IP.
[QUOTE=StonedPenguin;48998480]Would it be possible to add a function to bind what IP it uses to connect? Right now if the IP it uses goes offline there's no way to make it chose an online IP.[/QUOTE]
Why would the DB go offline?
[QUOTE=Aide;48998578]Why would the DB go offline?[/QUOTE]
DoS, if the database is not on the same network as the server
[QUOTE=StonedPenguin;48998480]Would it be possible to add a function to bind what IP it uses to connect? Right now if the IP it uses goes offline there's no way to make it chose an online IP.[/QUOTE]
I don't understand what you mean at all. You mean like.. changing the IP for when it auto-reconnects? If it fails to reconnect it should throw an error to the results and you would be able to disconnect and reconnect I guess if necessary. I guess I could add a function to like force a reconnect with a different IP or something if that's what you want?
For example I have a dedi with 4 IPs, the module connects to the database via IP #1, if IP #1 on that dedi gets taken offline the module cannot connect to a database whatsoever.
So what are you proposing I do exactly..? Make a reconnect function? This sounds more like an issue you should be solving on your end and not with a change to the module. I really don't understand what you want or expect the module to do. If the server goes offline, it will try to reconnect once and only once per query. If it fails the query result will have an error accordingly.
[QUOTE=BlackAwps;48999453]So what are you proposing I do exactly..? Make a reconnect function? This sounds more like an issue you should be solving on your end and not with a change to the module. I really don't understand what you want or expect the module to do. If the server goes offline, it will try to reconnect once and only once per query. If it fails the query result will have an error accordingly.[/QUOTE]
He means an alternate ip for the server to try if the first is unreachable on a reconnect attempt. Which most likey would be smarter to do with a function him self.
[QUOTE=StonedPenguin;48998480]Would it be possible to add a function to bind what IP it uses to connect? Right now if the IP it uses goes offline there's no way to make it chose an online IP.[/QUOTE]
This is something you should be implementing yourself with a "pool" of connections. The purpose of the module isn't to provide any and every abstraction but instead an interface for you to use.
[QUOTE=BlackAwps;48910849]You should try mariadb if you have issues with encoding. It's what I used for my servers when I ran some and never had any encoding issues.[/QUOTE]
Got mariadb set up and working, getting exact same error.
At this point, I'm guessing it's a gmod issue rather than database issue; because I can enter problem strings in to the database via other methods.
[QUOTE=BlackAwps;48999453]So what are you proposing I do exactly..? Make a reconnect function? This sounds more like an issue you should be solving on your end and not with a change to the module. I really don't understand what you want or expect the module to do. If the server goes offline, it will try to reconnect once and only once per query. If it fails the query result will have an error accordingly.[/QUOTE]
I don't think you understand what I mean, I'm not sure how else to explain this. There's no way to bind what IP the module uses to connect to the database, it seems to always use one IP and if that one IP it always tries to use to connect goes offline every server on my machine cannot connect to any database. Maybe making the module bind itself to the gameservers IP would be a decent fix for this?
[QUOTE=StonedPenguin;49001805]I don't think you understand what I mean, I'm not sure how else to explain this. There's no way to bind what IP the module uses to connect to the database, it seems to always use one IP and if that one IP it always tries to use to connect goes offline every server on my machine cannot connect use the module to connect to any database. Maybe making the module bind itself to the gameservers IP would be a decent fix for this?[/QUOTE]
He does raise a decent point I guess, If x.x.x.1 gets nullrouted, tmysql will fail to actally work even if x.x.x.2 is available and so on.
Sooo you basically want a binding for MYSQL_SET_CLIENT_IP
I think I could do something for this.. I actually want to make a more advanced connect option so you could pass connect options yourself, where this would come into play.
[editline]28th October 2015[/editline]
Okay so.. I just added Database:Option(MYSQL_, String option)
So you should be able to do something like
[lua]Database:Option(MYSQL_SET_CLIENT_IP, "IP YOU WANT TO USE HERE")[/lua]
before you connect
I also added..
tmysql.Create(same argument as tmysql.intialize but creates a disconnected database)
Database:Connect() returns status, error
Database:GetServerInfo() returns a string
Database:GetHostInfo() returns a string
Database:GetServerVersion() returns a number
I removed tmysql.GetDatabase(String database) because of the change below
You can now connect to a database more than once without it reusing the connection
I also changed Database:SetCharacterSet to use a mutex so it should be thread safe
I'm setting up my windows 8.1 VM to compile a windows build and will have that done shortly.
Hey I was wondering if I could get a bit of help with this. I have tried every version on the pages for this module but none of them seem to work.
Here is my output from ldd on Ubuntu 14.04LTS
[code]
ldd gmsv_tmysql4_linux.dll
linux-gate.so.1 => (0xf76ff000)
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf7207000)
libm.so.6 => /lib32/libm.so.6 (0xf71c1000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf71a4000)
libc.so.6 => /lib32/libc.so.6 (0xf6ff9000)
/lib/ld-linux.so.2 (0xf7701000)
[/code]
and I am using the following line at the top of my db file [code]require("tmysql4")[/code]
When I start my gamemode, the following error happens
[code]
[ERROR] gamemodes/test/gamemode/sv_db.lua:1: Couldn't load module library!
1. require - [C]:-1
2. unknown - gamemodes/test/gamemode/sv_db.lua:1
3. include - [C]:-1
4. unknown - gamemodes/test/gamemode/sv_includes.lua:2
5. include - [C]:-1
6. unknown - gamemodes/test/gamemode/init.lua:8
[ERROR] gamemodes/test/gamemode/sv_db.lua:1: Couldn't load module library!
1. require - [C]:-1
2. unknown - gamemodes/test/gamemode/sv_db.lua:1
3. include - [C]:-1
4. unknown - gamemodes/test/gamemode/sv_includes.lua:2
5. include - [C]:-1
6. unknown - gamemodes/test/gamemode/init.lua:8
[/code]
Any ideas? I have been trying all day and nothing seems to be working.
[QUOTE=BlackAwps;48942280]That's not very useful. Can you disable your addons, run your server in debug mode as described in this link
[url]https://facepunch.com/showthread.php?t=1485127&p=48928932&viewfull=1#post48928932[/url]
Mainly
[code]LD_LIBRARY_PATH=garrysmod/bin:bin:. LD_DEBUG=libs ./srcds_linux -game garrysmod +map gm_construct[/code]
run
[code]lua_run require"tmysql4"[/code] and report the error back to us please?[/QUOTE]
Can you try this and report back with the error you get after
[QUOTE=BlackAwps;49024947]Can you try this and report back with the error you get after[/QUOTE]
Sure no problem, here is the output when it tries to load the module.
[code] 22557: /home/steam/server_1/garrysmod/lua/bin/gmsv_tmysql4_linux.dll: error: symbol lookup error: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERjj (fatal) [/code]
Had to change line 131 on the wrapper to [lua] --old code
--self:onData({k=v})
--new code
self:onData(v) [/lua] to get it to work as a drop-in replacement for MySQLoo
but, I keep getting crashes on changelevel (TTT server, so very important)
crash dump: [url]http://nalyd.net/srcds_150812_crash_2015_11_1T14_20_34C0.7z[/url]
--edit--
fixed the missing .7z mimetype on my webserver, should download now instead of trying to show as UTF-8
Eh. Server's crashing every 15 minutes or so now, I'd give relevant crash logs but it's not making any.
[QUOTE=DylanWilson;49026843]but, I keep getting crashes on changelevel (TTT server, so very important)[/QUOTE]
Sure you're using the latest module? I don't have this issue anymore on it.
[QUOTE=StonedPenguin;49027765]Sure you're using the latest module? I don't have this issue anymore on it.[/QUOTE]
I grabbed it from the link in the OP about an hour before I posted, so, I guess so?
[QUOTE=DylanWilson;49026843]Had to change line 131 on the wrapper to [lua] --old code
--self:onData({k=v})
--new code
self:onData(v) [/lua] to get it to work as a drop-in replacement for MySQLoo
but, I keep getting crashes on changelevel (TTT server, so very important)
crash dump: [url]http://nalyd.net/srcds_150812_crash_2015_11_1T14_20_34C0.7z[/url]
--edit--
fixed the missing .7z mimetype on my webserver, should download now instead of trying to show as UTF-8[/QUOTE]
Added your fix for onData, thanks.
Crash dump is a crash in the kernel and there's no stack-trace of the module causing this. Mind showing any code you may be doing on shutdown?
Okay so I think I figured out the crash. If there's a pending query during shutdown the database objects gets garbage collected too late and crashes during the pcall to the callback... I think I'm just going to remove the whole garbage collection function from the database since all databases get properly handled on shutdown anyway.
[B][U]Fixed and updated Linux and Windows builds[/U][/B]
[editline]1st November 2015[/editline]
[QUOTE=icebox3d;49026665]Sure no problem, here is the output when it tries to load the module.
[code] 22557: /home/steam/server_1/garrysmod/lua/bin/gmsv_tmysql4_linux.dll: error: symbol lookup error: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERjj (fatal) [/code][/QUOTE]
Weird, I'll have to investigate this. Can you tell me what Linux distribution you are using? I've tested the module to be working on Ubuntu 12.04, Ubuntu 14.04 and Debian Wheezy
Hey!
Yeah sure, I have been using Ubuntu14.04 LTS and also tried on Debian Jessie but same issue :(
I just updated the linux build that I built on debian jessie. So try that and see if it works for you now.
Still errors but different one this time
[code] 30805: /home/steam/server_1/garrysmod/lua/bin/gmsv_tmysql4_linux.dll: error: symbol lookup error: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERjj (fatal)
[/code]
[code] ldd gmsv_tmysql4_linux.dll
linux-gate.so.1 => (0xf7776000)
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf7282000)
libm.so.6 => /lib32/libm.so.6 (0xf723c000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf721f000)
libc.so.6 => /lib32/libc.so.6 (0xf7074000)
/lib/ld-linux.so.2 (0xf7778000)
[/code]
Okay... I think I know what's causing it. Give me a few minutes and I'll edit this post when I think I've fixed it.
Sure :)
Just for giggles I am building a Debian Jessie server as I tend to use Ubuntu more. Shall see if it loads there
[editline]2nd November 2015[/editline]
Here is what I got from the Jessie server
[code] 5316: /home/steam/server_1/garrysmod/lua/bin/gmsv_tmysql4_linux.dll: error: symbol lookup error: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERjj (fatal)
[/code]
[code]ldd garrysmod/lua/bin/gmsv_tmysql4_linux.dll
linux-gate.so.1 (0xf7737000)
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf7239000)
libm.so.6 => /lib32/libm.so.6 (0xf71f3000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf71d6000)
libc.so.6 => /lib32/libc.so.6 (0xf702c000)
/lib/ld-linux.so.2 (0xf773a000)
[/code]
Thanks for the quick support blackawps
out of curiosity, do you have any plans to support prepared statements? I know escape works, but preparing the statement is so much cleaner
Sorry, you need to Log In to post a reply to this thread.