barronwaffles / dwc_network_server_emulator

A Nintendo DS and Wii server emulator.
GNU Affero General Public License v3.0
1.06k stars 165 forks source link

Server connection problem #136

Closed DevEkode closed 9 years ago

DevEkode commented 9 years ago

Hello again, when i tried to connect to my server i get this error:

[2015-04-21 11:11:17 | NasServer] Request to /ac from ('127.0.0.1', 45559) [2015-04-21 11:11:17 | NasServer] {'lang': '02', 'gamecd': 'AMCP', 'makercd': '01', 'unitcd': '0', 'bssid': '00f01a2b3c4d', 'passwd': '928', 'devname': 'y\x00o\x00p\x00y\x00o\x00p\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'userid': '3405195916006', 'macadr': '0009bf123456', 'apinfo': '00:0000000-0', 'devtime': '150421111114', 'birth': '070f', 'action': 'acctcreate', 'sdkver': '001000'} 127.0.0.1 - - [21/Apr/2015 11:11:17] "POST /ac HTTP/1.1" 200 - [2015-04-21 11:11:17 | GamespyDatabase] [7nlj45PY] STARTING: SELECT max(userid) FROM users [2015-04-21 11:11:17 | GamespyDatabase] [7nlj45PY] DONE: Took 0.000425100326538 real time / 0.0 processor time [2015-04-21 11:11:17 | NasServer] Unknown exception: Traceback (most recent call last): File "/root/dwc_network_server_emulator/nas_server.py", line 105, in do_POST ret['userid'] = self.server.db.get_next_available_userid() File "/root/dwc_network_server_emulator/gamespy/gs_database.py", line 417, in get_next_available_userid userid = str(int(json.loads(r['max(userid)'])) + 1) File "/usr/lib/python2.7/json/init.py", line 338, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 365, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) TypeError: expected string or buffer

DevEkode commented 9 years ago

the error has gone oddly, I will comment on it if there's new

DevEkode commented 9 years ago

Ok news: The error is back and on desmume Wifi i get the error code 20101

kyle95wm commented 9 years ago

Hmm looks like there's a problem with acct create. @SMTDDR ?

kyle95wm commented 9 years ago

I just tested just now and I do indeed have the same problem after banning myself and attempting to get a new ID

[2015-04-21 22:45:17 | NasServer] {'lang': '01', 'gamecd': 'RMCE', 'makercd': '01', 'unitcd': '1', 'region': '01', 'macadr': '0017ab1c5e3c', 'cfc': '3076012600507020', 'devtime': '150421184458', 'csnum': 'LU1111841451', 'action': 'acctcreate', 'sdkver': '001000'} 127.0.0.1 - - [21/Apr/2015 22:45:17] "POST /ac HTTP/1.1" 200 - [2015-04-21 22:45:17 | GamespyDatabase] [wAFSAebf] STARTING: SELECT max(userid) FROM users [2015-04-21 22:45:17 | GamespyDatabase] [wAFSAebf] DONE: Took 0.00667595863342 real time / 0.0 processor time [2015-04-21 22:45:19 | NasServer] Unknown exception: Traceback (most recent call last): File "/home/pi/dwc_network_server_emulator/nas_server.py", line 105, in do_POST ret['userid'] = self.server.db.get_next_available_userid() File "/home/pi/dwc_network_server_emulator/gamespy/gs_database.py", line 417, in get_next_available_userid userid = str(int(json.loads(r['max(userid)'])) + 1) File "/usr/lib/python2.7/json/init.py", line 326, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 368, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 1 column 1 - line 1 column 13 (char 1 - 13)

[2015-04-21 22:45:19 | NasServer] Request to /ac from ('127.0.0.1', 34900) [2015-04-21 22:45:19 | NasServer] {'lang': '01', 'gamecd': 'RMCE', 'makercd': '01', 'unitcd': '1', 'region': '01', 'macadr': '0017ab1c5e3c', 'cfc': '3076012600507020', 'devtime': '150421184501', 'csnum': 'LU1111841451', 'action': 'acctcreate', 'sdkver': '001000'} 127.0.0.1 - - [21/Apr/2015 22:45:19] "POST /ac HTTP/1.1" 200 - [2015-04-21 22:45:19 | GamespyDatabase] [3ogp70wd] STARTING: SELECT max(userid) FROM users [2015-04-21 22:45:19 | GamespyDatabase] [3ogp70wd] DONE: Took 0.00652313232422 real time / 0.01 processor time [2015-04-21 22:45:19 | NasServer] Unknown exception: Traceback (most recent call last): File "/home/pi/dwc_network_server_emulator/nas_server.py", line 105, in do_POST ret['userid'] = self.server.db.get_next_available_userid() File "/home/pi/dwc_network_server_emulator/gamespy/gs_database.py", line 417, in get_next_available_userid userid = str(int(json.loads(r['max(userid)'])) + 1) File "/usr/lib/python2.7/json/init.py", line 326, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 368, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 1 column 1 - line 1 column 13 (char 1 - 13)

[2015-04-21 22:45:19 | NasServer] Request to /ac from ('127.0.0.1', 34901) [2015-04-21 22:45:19 | NasServer] {'lang': '01', 'gamecd': 'RMCE', 'makercd': '01', 'unitcd': '1', 'region': '01', 'macadr': '0017ab1c5e3c', 'cfc': '3076012600507020', 'devtime': '150421184501', 'csnum': 'LU1111841451', 'action': 'acctcreate', 'sdkver': '001000'} 127.0.0.1 - - [21/Apr/2015 22:45:19] "POST /ac HTTP/1.1" 200 - [2015-04-21 22:45:19 | GamespyDatabase] [PZksFDGi] STARTING: SELECT max(userid) FROM users [2015-04-21 22:45:19 | GamespyDatabase] [PZksFDGi] DONE: Took 0.0068371295929 real time / 0.01 processor time [2015-04-21 22:45:19 | NasServer] Unknown exception: Traceback (most recent call last): File "/home/pi/dwc_network_server_emulator/nas_server.py", line 105, in do_POST ret['userid'] = self.server.db.get_next_available_userid() File "/home/pi/dwc_network_server_emulator/gamespy/gs_database.py", line 417, in get_next_available_userid userid = str(int(json.loads(r['max(userid)'])) + 1) File "/usr/lib/python2.7/json/init.py", line 326, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 368, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 1 column 1 - line 1 column 13 (char 1 - 13)

SMTDDR commented 9 years ago

ugh.... I don't understand how this happens, but https://github.com/polaris-/dwc_network_server_emulator/pull/137

SMTDDR commented 9 years ago

I guess instead of my proposed lazy catch-all solution, I gotta actually figure out why this error happens. Can someone upload their gpcm.db that causes this error?

kyle95wm commented 9 years ago

Fortunately this is very easy to test. It's a clean database file and it's guaranteed to throw the error but I'll fetch my db file and upload it

AdmiralCurtiss commented 9 years ago

Btw if I had to guess then it probably doesn't like the fact that you're trying to access a returned column with braces. Try "SELECT max(id) AS maxid" and then access ['maxid'], lemme see...

AdmiralCurtiss commented 9 years ago

FYI this throws error 20101 on the DS so we can probably close other reports about that.

AdmiralCurtiss commented 9 years ago

Dude did you even test this? There's like three different errors in those few lines of code.

kyle95wm commented 9 years ago

any updates? I desperately need to get my server up and I need a server to give unique ID's to have an easier time managing the bans

SMTDDR commented 9 years ago

Something odd is going on. I actually don't even understand how the code ever worked.

https://github.com/polaris-/dwc_network_server_emulator/blob/ca09df8b33fb1e280e4dd3a09ccea1bcd5043323/gamespy/gs_database.py#L413

row = conn.cursor().execute('select max(userid) from users').fetchone()
r = dict(itertools.izip(row.keys(), row))
Traceback (most recent call last): File "<stdin>", line 1, in <module>
    AttributeError: 'tuple' object has no attribute 'keys'

This code definitely worked at one time. We tested it with Mariokart. Was sqlite3 upgraded recently or something else updated? Cuz now I can't even run it.

SMTDDR commented 9 years ago

idunno @AdmiralCurtiss That fix o_o Yeah, something somewhere changed. I didn't have to do that before.

AdmiralCurtiss commented 9 years ago

I have no idea how that json.decode thing could have ever worked really, sqlite doesn't return json, it just returns a completely standard dict.

kyle95wm commented 9 years ago

Well I finally got it working but it was as simple as connecting a Nintendo-connected console to the server (as in it was never formatted after shut down) and acct create works pretty much the way it should now. The only thing we need to figure out is why and how to fix it for anyone not so fortunate with their server.

kyle95wm commented 9 years ago

Okay I just tested your fix @AdmiralCurtiss and it works!

SMTDDR commented 9 years ago

Hooray! applaud