-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm trying to debug the following error which appear numerous time on
http://www.skyrock.com/poker:

#:/var/log$ grep  "_mysql_exceptions.OperationalError: (1054"
poker-network-server.log
2009-03-28 11:52:31+0100 [HTTPChannel,57134,172.19.21.3]
_mysql_exceptions.OperationalError: (1054, "Unknown column 'None' in
'field list'")
2009-03-28 12:12:40+0100 [HTTPChannel,65439,172.19.21.4]
_mysql_exceptions.OperationalError: (1054, "Unknown column 'None' in
'field list'")
2009-03-28 13:35:28+0100 [HTTPChannel,97455,172.19.21.4]
_mysql_exceptions.OperationalError: (1054, "Unknown column 'None' in
'field list'")
2009-03-28 14:41:39+0100 [HTTPChannel,130707,172.19.21.4]
_mysql_exceptions.OperationalError: (1054, "Unknown column 'None' in
'field list'")
2009-03-28 16:42:56+0100 [HTTPChannel,197023,172.19.21.4]
_mysql_exceptions.OperationalError: (1054, "Unknown column 'None' in
'field list'")
2009-03-28 17:02:13+0100 [HTTPChannel,207901,172.19.21.3]
_mysql_exceptions.OperationalError: (1054, "Unknown column 'None' in
'field list'")
2009-03-28 17:18:02+0100 [HTTPChannel,218911,172.19.21.3]
_mysql_exceptions.OperationalError: (1054, "Unknown column 'None' in
'field list'")
2009-03-28 17:25:10+0100 [HTTPChannel,223351,172.19.21.4]
_mysql_exceptions.OperationalError: (1054, "Unknown column 'None' in
'field list'")

Here is the full traceback:

 PokerResource: *ERROR* (x-cluster-client-ip:81.50.0.121) Traceback
(most recent call last):
   File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py",
line 185, in addCallbacks
     self._runCallbacks()
   File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py",
line 323, in _runCallbacks
     self.result = callback(self.result, *args, **kw)
   File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py",
line 244, in <lambda>
     deferred.addCallback(lambda result: self.deferRender(request,
jsonp, packet))
   File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py",
line 255, in deferRender
     d = defer.maybeDeferred(session.avatar.handlePacketDefer, packet)
 --- <exception caught here> ---
   File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py",
line 105, in maybeDeferred
     result = f(*args, **kw)
   File "/usr/lib/python2.5/site-packages/pokernetwork/pokeravatar.py",
line 342, in handlePacketDefer
     self.handlePacketLogic(packet)
   File "/usr/lib/python2.5/site-packages/pokernetwork/pokeravatar.py",
line 655, in handlePacketLogic
     if not table.rebuyPlayerRequest(self, packet.amount):
   File "/usr/lib/python2.5/site-packages/pokernetwork/pokertable.py",
line 1330, in rebuyPlayerRequest
     amount = self.factory.buyInPlayer(serial, game.id,
self.currency_serial, min(amount, maximum))
   File "/usr/lib/python2.5/site-packages/pokernetwork/pokerservice.py",
line 1899, in buyInPlayer
     cursor.execute(sql)
   File "/usr/lib/python2.5/site-packages/MySQLdb/cursors.py", line 163,
in execute
     self.errorhandler(self, exc, value)
   File "/usr/lib/python2.5/site-packages/MySQLdb/connections.py", line
35, in defaulterrorhandler
     raise errorclass, errorvalue
 _mysql_exceptions.OperationalError: (1054, "Unknown column 'None' in
'field list'")


I've been able to reproduce it in poker-network locally by calling
PokerService.buyInPlayer with a None amount:
self.service.buyInPlayer(user_serial, table_serial, currency_serial, None)

Which cause the following sql statement to be executed:
UPDATE user2money,user2table SET user2table.money = user2table.money +
'None', user2money.amount = user2money.amount - 'None' ...

And trigger the same error:
_mysql_exceptions.OperationalError: (1054, "Unknown column 'None' in
'field list'")

I came to the conclusion that the server received a PACKET_POKER_REBUY
with a None amount:

Which could be trigger by this code jpoker under certain conditions:
3933 $('.jpoker_rebuy_action', rebuy).click(function() {
3934 var server = jpoker.getServer(url);
3935 if(server) {
3936 server.sendPacket({ 'type': packet_type,
3937 'serial': server.serial,
3938 'game_id': table.id,
3939 'amount': parseInt($('.jpoker_rebuy_current', rebuy).html(), 10) * 100
3940 });
3941 }
3942 rebuy.dialog('close');
3943 });
3944

Line 3939 of jquery.jpoker.js:
parseInt($('.jpoker_rebuy_current', rebuy).html(), 10) returns NaN if
$('.jpoker_rebuy_current', rebuy).html() is "" (empty string).
>>> parseInt("", 10)*100
NaN

NaN get encoded to null by JSON2.js:
>>> JSON.stringify({"amount":NaN})
"{"amount":null}"

Python simplejson decode null as None:
>>> json.loads('{"amount":null}')
{u'amount': None}

PokerService.buyInPlayer is called with a None amount and trigger
_mysql_exceptions.OperationalError

Now that I know where it comes from, I'm not sure if it should be
fixtured and fixed client side, or server side, or both ?

Any inputs ?

Thanks in advance
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknOXI0ACgkQZmEdV9SHoe5jjgCfR2JoZEW87RkjzeUVieoBEEFe
/y0An3LS5CFyo15+JsuhgkHwZtSWC6w4
=z4XH
-----END PGP SIGNATURE-----

_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users

Reply via email to