Strange lockup during functional tests (sandboxed)
Hi, I'm running Zope 2.7.5-1, python 2.3.5-2 and experience that during the runnig of my own functional tests (sandboxed) after a few tests the program locks up (CTRL-C does not work, CTRL-Z yes). I can reproduce the issue with the following test: --- from Testing import ZopeTestCase ZopeTestCase.utils.setupCoreSessions(ZopeTestCase.Zope.app()) class TestSessionBug(ZopeTestCase.Functional, ZopeTestCase.ZopeTestCase): ''' This locks up in the start of test07! The checkpoint is never reached. ''' def afterSetUp(self): print 'Checkpoint' request = self.app.REQUEST sdm = self.app.session_data_manager request.set('SESSION', sdm.getSessionData()) self.sessipn = request.SESSION def test_01(self): pass def test_02(self): pass def test_03(self): pass def test_04(self): pass def test_05(self): pass def test_06(self): pass def test_07(self): pass def test_08(self): pass def test_09(self): pass def test_10(self): pass def test_11(self): pass def test_suite(): from unittest import TestSuite, makeSuite suite = TestSuite() suite.addTest(makeSuite(TestSessionBug)) return suite -- The setup of the sessions in the above code triggers the problem but it might not be its direct reason. Even without this it happens in some of my test methods. The lockup is very deterministic and it does not seem to have much to do with the test methods themselves, that is, if I just run the test method where it broke, it does not occur. What am I missing? Can someone reproduce this? -- Balazs REE
ZopeTestCase.app() returns a new connection which you would have to ZopeTestCase.close(app) after use. If you forget to close, you will deplete the connection pool and cause the hang you experience. Also, note that the app argument to utility methods is *optional*, and setupCoreSessions() will manage the connection for you if you omit it. So, make this ZopeTestCase.utils.setupCoreSessions() and all should be fine. HTH, Stefan On 23. Apr 2005, at 15:39, Balazs Ree wrote:
ZopeTestCase.utils.setupCoreSessions(ZopeTestCase.Zope.app())
-- Software Engineering is Programming when you can't. --E. W. Dijkstra
Sat, 23 Apr 2005 16:48:21 +0200 keltezéssel Stefan H. Holek azt írta:
ZopeTestCase.app() returns a new connection which you would have to ZopeTestCase.close(app) after use. If you forget to close, you will deplete the connection pool and cause the hang you experience.
This might be true, but the problem is not caused by this. Neither app = ZopeTestCase.app() ZopeTestCase.utils.setupCoreSessions(app) ZopeTestCase.close(app) , nor ZopeTestCase.utils.setupCoreSessions() solves it. The only way to make the error disappear is to get rid of the request.set('SESSION', ...). -- Balazs REE
participants (2)
-
Balazs Ree -
Stefan H. Holek