Ticket #501 (closed defect: fixed)

Opened 15 years ago

Last modified 15 years ago

serious errors at login time when member still in cache

Reported by: atchertchian Owned by: trac
Priority: P1 Milestone: unspecified
Component: CPSUserFolder Version: unspecified
Severity: normal Keywords:
Cc:

Description

Serious errors happen at login time when executing member.setProperties and member.getProperties methods in logged_in page, when user is cached.

If i login, logout, and then relogin as the same user, first error is :

Traceback (innermost last):

Module ZPublisher.Publish, line 107, in publish Module Zope.App.startup, line 222, in commit Module ZODB.Transaction, line 240, in commit Module ZODB.Transaction, line 348, in _commit_begin Module ZODB.Connection, line 729, in tpc_begin

AttributeError?: 'NoneType?' object has no attribute 'tpc_begin'

I i logout again and login again, error is:

Traceback (innermost last):

Module ZPublisher.Publish, line 101, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module Shared.DC.Scripts.Bindings, line 306, in call Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec Module Products.CMFCore.FSPageTemplate, line 180, in _exec Module Products.CMFCore.FSPageTemplate, line 119, in pt_render Module Products.PageTemplates.PageTemplate?, line 96, in pt_render

  • <FSPageTemplate at /cps/logged_in>

Module TAL.TALInterpreter, line 190, in call Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 409, in do_optTag_tal Module TAL.TALInterpreter, line 394, in do_optTag Module TAL.TALInterpreter, line 389, in no_tag Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 671, in do_useMacro Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 409, in do_optTag_tal Module TAL.TALInterpreter, line 394, in do_optTag Module TAL.TALInterpreter, line 389, in no_tag Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 637, in do_condition Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 407, in do_optTag_tal Module TAL.TALInterpreter, line 389, in no_tag Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 694, in do_defineSlot Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 409, in do_optTag_tal Module TAL.TALInterpreter, line 394, in do_optTag Module TAL.TALInterpreter, line 389, in no_tag Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 637, in do_condition Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 460, in do_setLocal_tal Module Products.PageTemplates.TALES, line 221, in evaluate

  • URL: file:MSGDefault/skins/msgdefault_default/logged_in.pt
  • Line 23, Column 4
  • Expression: <PythonExpr? member.setProperties(

last_login_time=member.getProperty('login_time', None))>

  • Names:

{'container': <MSGPortal instance at b44eb4a0>,

'context': <MSGPortal instance at b44eb4a0>, 'default': <Products.PageTemplates.TALES.Default instance at 0xb7383a4c>, 'here': <MSGPortal instance at b44eb4a0>, 'loop': <SafeMapping? instance at b46e7f50>, 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter

instance at 0xb737df2c>,

'nothing': None, 'options': {'args': ()}, 'repeat': <SafeMapping? instance at b46e7f50>, 'request': <HTTPRequest, URL= http://localhost:23080/cps/logged_in>, 'root': <Application instance at b401f890>, 'template': <FSPageTemplate at /cps/logged_in>, 'traverse_subpath': [], 'user': <CPSUser pilote>}

Module Products.PageTemplates.ZRPythonExpr, line 47, in call

  • traceback_info: member.setProperties(

last_login_time=member.getProperty('login_time', None))

Module Python expression "member.setProperties(

last_login_time=member.getProperty('login_time', None))", line 1, in <expression>

Module Products.CMFCore.MemberDataTool?, line 305, in setProperties Module Products.CPSDirectory.MemberToolsPatch?, line 323, in setMemberProperties Module Products.CPSUserFolder.CPSUserFolder, line 894, in setProperties Module Products.CPSUserFolder.CPSUserFolder, line 172, in _removeUserIdFromCache Module Products.CPSUserFolder.CPSUserFolder, line 187, in _removeUserFromIdCache Module Products.CPSUserFolder.CPSUserFolder, line 153, in _getCache Module OFS.Traversable, line 105, in getPhysicalPath Module ZODB.Connection, line 587, in setstate

RuntimeError?: Shouldn't load state for 0x9d69 when the connection is closed

Problem does not happen with only one thread and caching activated, and does not happen with several threads and caching deactivated.

Change History

comment:1 Changed 15 years ago by fguillaume

  • Status changed from new to assigned
  • Priority changed from P2 to P1
  • Cc bugs@… added

Problem with the cache holding indirectly to persistent objects, which makes them move around threads, which is forbidden...

comment:2 Changed 15 years ago by atchertchian

After replacing portal_memberdata by a CPS Member Data Tool (not CMF) and adding the following lines at the end of getUserWithAuthentication :

user._aclu = self user._dir = self._getUsersDirectory()

Traceback (innermost last):

Module ZPublisher.Publish, line 101, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module Shared.DC.Scripts.Bindings, line 306, in call Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec Module Products.CMFCore.FSPageTemplate, line 180, in _exec Module Products.CMFCore.FSPageTemplate, line 119, in pt_render Module Products.PageTemplates.PageTemplate?, line 96, in pt_render

  • <FSPageTemplate at /cps/logged_in>

Module TAL.TALInterpreter, line 190, in call Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 409, in do_optTag_tal Module TAL.TALInterpreter, line 394, in do_optTag Module TAL.TALInterpreter, line 389, in no_tag Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 671, in do_useMacro Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 409, in do_optTag_tal Module TAL.TALInterpreter, line 394, in do_optTag Module TAL.TALInterpreter, line 389, in no_tag Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 637, in do_condition Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 407, in do_optTag_tal Module TAL.TALInterpreter, line 389, in no_tag Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 694, in do_defineSlot Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 409, in do_optTag_tal Module TAL.TALInterpreter, line 394, in do_optTag Module TAL.TALInterpreter, line 389, in no_tag Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 637, in do_condition Module TAL.TALInterpreter, line 234, in interpret Module TAL.TALInterpreter, line 460, in do_setLocal_tal Module Products.PageTemplates.TALES, line 221, in evaluate

  • URL: file:MSGDefault/skins/msgdefault_default/logged_in.pt
  • Line 23, Column 4
  • Expression: <PythonExpr? member.setProperties(

last_login_time=member.getProperty('login_time', None))>

  • Names:

{'container': <MSGPortal instance at b68a1380>,

'context': <MSGPortal instance at b68a1380>, 'default': <Products.PageTemplates.TALES.Default instance at 0xb7383a4c>, 'here': <MSGPortal instance at b68a1380>, 'loop': <SafeMapping? instance at b46fcf80>, 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter

instance at 0xb737df2c>,

'nothing': None, 'options': {'args': ()}, 'repeat': <SafeMapping? instance at b46fcf80>, 'request': <HTTPRequest, URL= http://localhost:23080/cps/logged_in>, 'root': <Application instance at b68ef1a0>, 'template': <FSPageTemplate at /cps/logged_in>, 'traverse_subpath': [], 'user': <CPSUser pilote>}

Module Products.PageTemplates.ZRPythonExpr, line 47, in call

  • traceback_info: member.setProperties(

last_login_time=member.getProperty('login_time', None))

Module Python expression "member.setProperties(

last_login_time=member.getProperty('login_time', None))", line 1, in <expression>

Module Products.CPSUserFolder.CPSMemberDataTool, line 171, in setProperties Module Products.CPSUserFolder.CPSMemberDataTool, line 180, in setMemberProperties Module Products.CPSUserFolder.CPSUserFolder, line 902, in setProperties Module Products.CPSDirectory.BaseDirectory?, line 452, in editEntry Module Products.CPSDirectory.BaseDirectory?, line 725, in _getDataModel Module Products.CPSSchemas.DataModel?, line 243, in _fetch Module Products.CPSDirectory.MetaDirectory?, line 571, in getData Module Products.CPSDirectory.MetaDirectory?, line 523, in _getEntryFromBacking Module Products.CPSDirectory.BaseDirectory?, line 386, in _getEntry Module Products.CPSDirectory.BaseDirectory?, line 725, in _getDataModel Module Products.CPSSchemas.DataModel?, line 250, in _fetch Module Products.CPSSchemas.Field, line 149, in getDefault Module Products.CMFCore.Expression, line 39, in call Module ZODB.Connection, line 587, in setstate

RuntimeError?: Shouldn't load state for 0xc3ab when the connection is closed

comment:3 Changed 15 years ago by fguillaume

Ok the place to patch is actuall before the return user in the middle of getUserWithAuthentication.

This works around this immediate problem but is not a complete solution as the user object is still shared by all threads and at high load they may run simultaneously.

Solution involves making a new CPSUser object when the one from the cache is from a different thread.

comment:4 Changed 15 years ago by fguillaume

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixed by not storing a user object in the cache, but just the non-persistent info needed to recreate a user object.

Note: See TracTickets for help on using tickets.