bugpokersource - Bugs: bug #13717, Session instance has no attribute...

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #13717: Session instance has no attribute 'avatar'

Submitted by:  Loic Dachary <loic>
Submitted on:  Wed 17 Jun 2009 08:45:19 PM UTC  
 
Category: poker-networkSeverity: 3 - Normal
Priority: 7 - HighStatus: Need Info
Privacy: PublicAssigned to: Johan Euphrosine <proppy>
Open/Closed: Open

(Jump to the original submission Jump to the original submission)

Mon 14 Jun 2010 10:02:59 PM UTC, comment #21:

Hello =)

You can see "PokerAvatarCollection:service:remove 1 PokerAvatar serial = 1, name = XavieR"

just before a getSerial on missed avatar !

This bug is the most high in 2.0 !!!

is a pity because the long poll rocks!

Xavier
====================

2010-06-14 23:22:45+0200 [HTTPChannel,191,127.0.0.1] players = 0, tables = 17]
2010-06-14 23:22:45+0200 [HTTPChannel,191,127.0.0.1] PokerAvatar: connection lost for anonymous/0
2010-06-14 23:22:45+0200 [HTTPChannel,192,127.0.0.1] PokerResource: (x-forwarded-for:x.x.x.x) render {"type":"PacketPokerLongPoll"}
2010-06-14 23:22:45+0200 [HTTPChannel,192,127.0.0.1] PokerAvatarCollection:service:add 1 PokerAvatar serial = 1, name = XavieR
2010-06-14 23:22:45+0200 [HTTPChannel,192,127.0.0.1] PokerAvatar: handlePacketDefer(1): POKER_LONG_POLL type = 167 length = 3
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] PokerResource: (x-forwarded-for:178.32.99.82) render {"type":"PacketPokerGetTourneyManager","tourney_serial":326}
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] PokerAvatar: handlePacketDefer(1): POKER_GET_TOURNEY_MANAGER type = 148 length = 7 tourney_serial = 326
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] PokerAvatar: handlePacketLogic(1): POKER_GET_TOURNEY_MANAGER type = 148 length = 7 tourney_serial = 326
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] PokerAvatar: sendPacket(1): POKER_TOURNEY_MANAGER type = 149 length = 3
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] [1]PokerExplain:explain: POKER_TOURNEY_MANAGER type = 149 length = 3
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] PokerAvatar: flushLongPollDeferred([POKER_TOURNEY_MANAGER type = 149 length = 3]):
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] PokerResource: (x-forwarded-for:x.x.x.x) render {"type":"PacketPokerLongPoll"} returns [POKER_TOURNEY_MANAGER type = 149 length = 3]
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] PokerAvatar: connection lost for XavieR/1
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] PokerAvatarCollection:service:remove 1 PokerAvatar serial = 1, name = XavieR
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] PokerResource: (x-forwarded-for:178.32.99.82) render {"type":"PacketPokerGetTourneyManager","tourney_serial":326} returns []
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] PokerResource: ERROR (x-forwarded-for:178.32.99.82) Traceback (most recent call last):
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 328, in _runCallbacks
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] self.result = callback(self.result, args, *kw)
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py", line 244, in <lambda>
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] deferred.addCallback(lambda result: self.deferRender(request, jsonp, packet, data))
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py", line 292, in deferRender
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] d.addCallbacks(render, processingFailed)
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 186, in addCallbacks
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] self._runCallbacks()
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] --- <exception caught here> ---
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 328, in _runCallbacks
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] self.result = callback(self.result, args, *kw)
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py", line 266, in render
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] session.site.updateSession(session)
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py", line 498, in updateSession
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] serial = session.avatar.getSerial()
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1] exceptions.AttributeError: Session instance has no attribute 'avatar'
2010-06-14 23:22:48+0200 [HTTPChannel,193,127.0.0.1]
2010-06-14 23:22:48+0200 [HTTPChannel,194,127.0.0.1] PokerResource: (x-forwarded-for:x.x.x.x) render {"type":"PacketPokerLongPoll"}
2010-06-14 23:22:48+0200 [HTTPChannel,194,127.0.0.1] PokerAvatarCollection:service:add 1 PokerAvatar serial = 1, name = XavieR
2010-06-14 23:22:48+0200 [HTTPChannel,194,127.0.0.1] PokerAvatar: handlePacketDefer(1): POKER_LONG_POLL type = 167 length = 3

Vandemeulebroucke <ramboz>
Fri 12 Mar 2010 05:36:26 PM UTC, comment #20:

Please provide full server side log for this error.

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Mon 01 Mar 2010 10:47:47 AM UTC, comment #19:

Still happens with poker-network 2.0:
2010-03-01 04:17:35+0100 [-] Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 1048, in run
self.mainLoop()
File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 1057, in mainLoop
self.runUntilCurrent()
File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 705, in runUntilCurrent
call.func(*call.args, **call.kw)
File "/usr/lib/python2.5/site-packages/twisted/internet/task.py", line 114, in _call_
d = defer.maybeDeferred(self.f, self.a, *self.kw)
--- <exception caught here> ---
File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 106, in maybeDeferred
result = f(*args, **kw)
File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py", line 168, in checkExpired
server.Session.checkExpired(self)
File "/usr/lib/python2.5/site-packages/twisted/web/server.py", line 465, in checkExpired
self.expire()
File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py", line 152, in expire
self.site.resource.service.destroyAvatar(self.avatar)
exceptions.AttributeError: Session instance has no attribute 'avatar'

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Mon 01 Mar 2010 10:47:21 AM UTC, comment #18:

Still happens with poker-network 2.0:
2010-03-01 03:42:20+0100 [-] PokerResource: ERROR (x-forwarded-for:127.0.0.1) Traceback (most recent call last):
2010-03-01 03:42:20+0100 [-] File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 705, in runUntilCurrent
2010-03-01 03:42:20+0100 [-] call.func(*call.args, **call.kw)
2010-03-01 03:42:20+0100 [-] File "/usr/lib/python2.5/site-packages/pokernetwork/pokeravatar.py", line 375, in longPollDeferredTimeout
2010-03-01 03:42:20+0100 [-] d.callback(packets)
2010-03-01 03:42:20+0100 [-] File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 243, in callback
2010-03-01 03:42:20+0100 [-] self._startRunCallbacks(result)
2010-03-01 03:42:20+0100 [-] File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 312, in _startRunCallbacks
2010-03-01 03:42:20+0100 [-] self._runCallbacks()
2010-03-01 03:42:20+0100 [-] --- <exception caught here> ---
2010-03-01 03:42:20+0100 [-] File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 328, in _runCallbacks
2010-03-01 03:42:20+0100 [-] self.result = callback(self.result, args, *kw)
2010-03-01 03:42:20+0100 [-] File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py", line 257, in render
2010-03-01 03:42:20+0100 [-] session.site.updateSession(session)
2010-03-01 03:42:20+0100 [-] File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py", line 489, in updateSession
2010-03-01 03:42:20+0100 [-] serial = session.avatar.getSerial()
2010-03-01 03:42:20+0100 [-] exceptions.AttributeError: Session instance has no attribute 'avatar'
2010-03-01 03:42:20+0100 [-]

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 16 Feb 2010 04:24:28 PM UTC, SVN revision 6419:

pokersite.checkExpired should not expire overwritten sessions bug #13717

(Browse SVN revision 6419)

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 16 Feb 2010 03:50:22 PM UTC, comment #16:

Please forward port this fix to poker-network 2.0

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 02 Feb 2010 02:02:01 PM UTC, SVN revision 6387:

pokersite.checkExpired should not expire overwritten sessions bug #13717

(Browse SVN revision 6387)

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 26 Jan 2010 04:32:35 PM UTC, comment #14:

I believe the problem described in the comment still exists on 2.0:

if you revert pokersite.py hunk, and run test03_replaceFromGetSession you get the following error:

Traceback (most recent call last):
File "./test-pokersite.py", line 749, in test03_replaceFromGetSession
self.assertEqual(False, session.checkExpired())
File "../pokernetwork/pokersite.py", line 168, in checkExpired
server.Session.checkExpired(self)
File "/usr/lib/python2.6/dist-packages/twisted/web/server.py", line 465, in checkExpired
self.expire()
File "../pokernetwork/pokersite.py", line 152, in expire
self.site.resource.service.destroyAvatar(self.avatar)
exceptions.AttributeError: Session instance has no attribute 'avatar'

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 26 Jan 2010 04:25:11 PM UTC, comment #13:

I believe https://gna.org/support/download.php?file_id=7805 must not include:

+ #
+ # The session may be replaced by a new session as a side
+ # effect of the verifications made by getSession against
+ # memcache. When this happens no exception is thrown and
+ # checkExpired should not be called because the session
+ # has already expired.
+ #
+ if not self.expired:
+ server.Session.checkExpired(self)
+ return True

but

assert not self.expired

in 2.0, because the condition described in the comment no longer exists in 2.0.

Loic Dachary <loic>
Project Administrator
Tue 26 Jan 2010 03:32:55 PM UTC, comment #12:

Ported the patch to trunk.

(file #7805)

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 26 Jan 2010 03:26:35 PM UTC, comment #11:

I believe the attached patch reproduce and fix this issue in poker-network-version0908.

(file #7804)

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 26 Jan 2010 02:46:37 PM UTC, comment #10:

I believe the attached patch reproduce this issue.

(file #7803)

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 26 Jan 2010 11:11:23 AM UTC, comment #9:

Still happens, even after applying the patch.

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 19 Jan 2010 05:05:11 PM UTC, SVN revision 6370:

backport patch for bug #13717, bug #15044, fix test suite, and apply ubuntu patches

(Browse SVN revision 6370)

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 19 Jan 2010 02:26:43 PM UTC, SVN revision 6368:

checkExpired should noop for already expired session, bug #13717

(Browse SVN revision 6368)

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 19 Jan 2010 08:37:29 AM UTC, comment #6:

The patch looks good and simple.

Loic Dachary <loic>
Project Administrator
Tue 12 Jan 2010 10:42:19 AM UTC, comment #5:

Hi,

I believe the attached patch reproduce and fixes this issue.

(file #7664)

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 23 Jun 2009 03:18:04 PM UTC, comment #4:

Hi,

I've managed to produce a similar traceback, with the attached test:
===============================================================================
[ERROR]: _main_.SessionTestCase.test02_expireFromTwisted

Traceback (most recent call last):
File "./test-pokersite.py", line 599, in test02_expireFromTwisted
session.checkExpired()
File "../pokernetwork/pokersite.py", line 178, in checkExpired
server.Session.checkExpired(self)
File "/usr/lib/python2.6/dist-packages/twisted/web/server.py", line 465, in checkExpired
self.expire()
File "../pokernetwork/pokersite.py", line 164, in expire
self.site.resource.service.destroyAvatar(self.avatar)
exceptions.AttributeError: Session instance has no attribute 'avatar'
===============================================================================

This is happening when pokersite.Session.checkExpired is called, after twisted expired a session due to sessionTimeout.

I believe pokersite should register using notifyOnExpire to be notified of session expired by twisted.

(file #6033)

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 23 Jun 2009 01:40:42 PM UTC, comment #3:

I spotted that 2 part of the code actually destroy the avatar:

pokersite.Session.expire:
del self.avatar

and

pokerservice.PokerXML.sessionExpires:
del session.avatar

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Tue 23 Jun 2009 09:59:29 AM UTC, comment #2:

I would first like to figure out how this can actually happen. If the session expired then checkExpired should not be called. Or is there a bug that calls checkExpired once too many ?

Loic Dachary <loic>
Project Administrator
Tue 23 Jun 2009 08:43:43 AM UTC, comment #1:

It looks like the session has already expired, and thus avatar has already been deleted.

Maybe checkExpired should also catch AttributeError (it already catch KeyError), what do you think ?

4194 loic def checkExpired(self):
4194 loic try:
4194 loic #
4194 loic # The session may expire as a side effect of the
4194 loic # verifications made by getSession against memcache.
4194 loic # When this happens an exception is thrown and checkExpire
4194 loic # is not called : this is intended because the
4194 loic # session already expired.
4194 loic #
4194 loic self.site.getSession(self.uid)
4194 loic server.Session.checkExpired(self)
4194 loic return True
4194 loic except KeyError:
4194 loic return False

Johan Euphrosine <proppy>
Project MemberIn charge of this item.
Wed 17 Jun 2009 08:45:19 PM UTC, original submission:

2009-06-17 13:28:22+0200 [HTTPChannel,283324,172.19.21.4] [Server][PokerGame 265161] ERROR: player 55909277 cannot call. state = pre-flop
2009-06-17 13:28:27+0200 [-] Unhandled error in Deferred:
2009-06-17 13:28:27+0200 [-] Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/twisted/internet/posixbase.py", line 223, in run
self.mainLoop()
File "/usr/lib/python2.5/site-packages/twisted/internet/posixbase.py", line 231, in mainLoop
self.runUntilCurrent()
File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 698, in runUntilCurrent
call.func(*call.args, **call.kw)
File "/usr/lib/python2.5/site-packages/twisted/internet/task.py", line 114, in _call_
d = defer.maybeDeferred(self.f, self.a, *self.kw)
--- <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/pokersite.py", line 178, in checkExpired
server.Session.checkExpired(self)
File "/usr/lib/python2.5/site-packages/twisted/web/server.py", line 465, in checkExpired
self.expire()
File "/usr/lib/python2.5/site-packages/pokernetwork/pokersite.py", line 164, in expire
self.site.resource.service.destroyAvatar(self.avatar)
exceptions.AttributeError: Session instance has no attribute 'avatar'

Loic Dachary <loic>
Project Administrator

 

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by ramboz (Posted a comment)
  • -unavailable- added by proppy (Posted a comment)
  • -unavailable- added by loic (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 23 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 12 Mar 2010 05:36:26 PM UTCproppyStatusIn Progress=>Need Info
    Mon 01 Mar 2010 06:36:11 PM UTCproppyCategoryNone=>poker-network
    Mon 01 Mar 2010 06:34:40 PM UTCproppyPriority5 - Normal=>7 - High
    Mon 01 Mar 2010 06:33:25 PM UTCproppyCategorypoker-network=>None
      Severity5 - Blocker=>3 - Normal
    Mon 01 Mar 2010 06:31:21 PM UTCproppyCategoryNone=>poker-network
    Mon 01 Mar 2010 10:47:21 AM UTCproppyStatusFixed=>In Progress
      Assigned toNone=>proppy
      Open/ClosedClosed=>Open
    Tue 23 Feb 2010 04:25:20 PM UTCproppyOpen/ClosedOpen=>Closed
    Tue 16 Feb 2010 03:50:22 PM UTCproppyOpen/ClosedClosed=>Open
    Tue 16 Feb 2010 01:40:46 PM UTCproppyOpen/ClosedOpen=>Closed
    Tue 09 Feb 2010 11:31:38 AM UTCproppyStatusReady For Test=>Fixed
    Tue 26 Jan 2010 03:32:55 PM UTCproppyAttached File-=>Added pokersite-checkexpired-ignore-already-expired-session-trunk.patch, #7805
    Tue 26 Jan 2010 03:26:50 PM UTCproppyStatusConfirmed=>Ready For Test
    Tue 26 Jan 2010 03:26:35 PM UTCproppyAttached File-=>Added 01-pokersite-checkexpired-ignore-already-expired-session.patch, #7804
    Tue 26 Jan 2010 02:46:37 PM UTCproppyAttached File-=>Added poker-site-check-expired-bug.patch, #7803
    Tue 26 Jan 2010 11:11:23 AM UTCproppyStatusFixed=>Confirmed
    Tue 19 Jan 2010 05:10:21 PM UTCproppyStatusReady For Test=>Fixed
    Tue 12 Jan 2010 10:42:26 AM UTCproppyStatusIn Progress=>Ready For Test
    Tue 12 Jan 2010 10:42:19 AM UTCproppyAttached File-=>Added poker-site-check-already-expired-session.patch, #7664
    Wed 24 Jun 2009 03:46:40 PM UTCproppyStatusNeed Info=>In Progress
    Tue 23 Jun 2009 03:18:04 PM UTCproppyAttached File-=>Added poker-site-expire-from-twisted.patch, #6033
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup