ice icon indicating copy to clipboard operation
ice copied to clipboard

Python GC failure

Open pepone opened this issue 1 year ago • 1 comments

*** [33/35] Running python/Ice/thread tests ***
[ running client/server test - 02/05/24 21:21:56 ]
- Config: ssl
("/opt/homebrew/opt/[email protected]/bin/python3.11"  /Users/runner/work/ice/ice/python/test/TestHelper.py Server --Ice.Default.Host=127.0.0.1 --Test.BasePort=14200 --Ice.Warn.Connections=1 --Ice.Default.Protocol=ssl --Ice.IPv6=0 --Ice.Plugin.IceSSL=IceSSL:createIceSSL --IceSSL.*** --IceSSL.DefaultDir=/Users/runner/work/ice/ice/certs --IceSSL.CAs=cacert.pem --IceSSL.CertFile=server.p12 --IceSSL.KeychainPassword=password --IceSSL.Keychain=server.keychain --Ice.ThreadPool.Server.Size=1 --Ice.ThreadPool.Server.SizeMax=3 --Ice.ThreadPool.Server.SizeWarn=0 --Ice.PrintAdapterReady=1 env={'DYLD_LIBRARY_PATH': '/Users/runner/work/ice/ice/cpp/lib', 'PYTHONPATH': '/Users/runner/work/ice/ice/python/python:/Users/runner/work/ice/ice/python/test/Ice/thread'})
("/opt/homebrew/opt/[email protected]/bin/python3.11"  /Users/runner/work/ice/ice/python/test/TestHelper.py Client --Ice.Default.Host=127.0.0.1 --Test.BasePort=14200 --Ice.Warn.Connections=1 --Ice.Default.Protocol=ssl --Ice.IPv6=0 --Ice.Plugin.IceSSL=IceSSL:createIceSSL --IceSSL.*** --IceSSL.DefaultDir=/Users/runner/work/ice/ice/certs --IceSSL.CAs=cacert.pem --IceSSL.CertFile=client.p12 --IceSSL.KeychainPassword=password --IceSSL.Keychain=client.keychain env={'DYLD_LIBRARY_PATH': '/Users/runner/work/ice/ice/cpp/lib', 'PYTHONPATH': '/Users/runner/work/ice/ice/python/python:/Users/runner/work/ice/ice/python/test/Ice/thread'})
testing thread hooks... ok
[ running client/server test - 02/05/24 21:21:57 ]
- Config: ws,compress,ipv6,serialize,mx
("/opt/homebrew/opt/[email protected]/bin/python3.11"  /Users/runner/work/ice/ice/python/test/TestHelper.py Server --Ice.Default.Host=::1 --Test.BasePort=14200 --Ice.Warn.Connections=1 --Ice.Default.Protocol=ws --Ice.Override.Compress=1 --Ice.ThreadPool.Server.Serialize=1 --Ice.IPv6=1 --Ice.PreferIPv6Address=1 --Ice.Admin.Endpoints="tcp -h \"::1\"" --Ice.Admin.InstanceName=Server --IceMX.Metrics.Debug.GroupBy=id --IceMX.Metrics.Parent.GroupBy=parent --IceMX.Metrics.All.GroupBy=none --Ice.ThreadPool.Server.Size=1 --Ice.ThreadPool.Server.SizeMax=3 --Ice.ThreadPool.Server.SizeWarn=0 --Ice.PrintAdapterReady=1 env={'DYLD_LIBRARY_PATH': '/Users/runner/work/ice/ice/cpp/lib', 'PYTHONPATH': '/Users/runner/work/ice/ice/python/python:/Users/runner/work/ice/ice/python/test/Ice/thread'})
("/opt/homebrew/opt/[email protected]/bin/python3.11"  /Users/runner/work/ice/ice/python/test/TestHelper.py Client --Ice.Default.Host=::1 --Test.BasePort=14200 --Ice.Warn.Connections=1 --Ice.Default.Protocol=ws --Ice.Override.Compress=1 --Ice.ThreadPool.Server.Serialize=1 --Ice.IPv6=1 --Ice.PreferIPv6Address=1 --Ice.Admin.Endpoints="tcp -h \"::1\"" --Ice.Admin.InstanceName=Client --IceMX.Metrics.Debug.GroupBy=id --IceMX.Metrics.Parent.GroupBy=parent --IceMX.Metrics.All.GroupBy=none env={'DYLD_LIBRARY_PATH': '/Users/runner/work/ice/ice/cpp/lib', 'PYTHONPATH': '/Users/runner/work/ice/ice/python/python:/Users/runner/work/ice/ice/python/test/Ice/thread'})
testing thread hooks... ok
Traceback (most recent call last):
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 1543, in stop
    process.waitSuccess(exitstatus=exitstatus, timeout=30)
  File "/Users/runner/work/ice/ice/scripts/Expect.py", line 691, in waitSuccess
    self.testExitStatus(exitstatus)
  File "/Users/runner/work/ice/ice/scripts/Expect.py", line 735, in testExitStatus
    test(self.exitstatus, exitstatus)
  File "/Users/runner/work/ice/ice/scripts/Expect.py", line 717, in test
    raise RuntimeError(
RuntimeError: unexpected exit status: expected: 0, got -6


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 2050, in run
    self.runWithDriver(current)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 2081, in runWithDriver
    current.driver.runClientServerTestCase(current)
  File "/Users/runner/work/ice/ice/scripts/LocalDriver.py", line 712, in runClientServerTestCase
    raise failure[0]
  File "/Users/runner/work/ice/ice/scripts/LocalDriver.py", line 693, in stopServerSide
    self.runner.stopServerSide(server, current, success)
  File "/Users/runner/work/ice/ice/scripts/LocalDriver.py", line 204, in stopServerSide
    testcase._stopServerSide(current, success)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 1997, in _stopServerSide
    self.stopServerSide(current, success)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 1909, in stopServerSide
    self._stopServer(current, server, success)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 2015, in _stopServer
    server.stop(current, success)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 1707, in stop
    IceProcess.stop(self, current, waitSuccess and self.waitForShutdown, exitstatus)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 1559, in stop
    raise RuntimeError(str(ex) + output)
RuntimeError: unexpected exit status: expected: 0, got -6
Fatal Python error: bool_dealloc: deallocating True or False: bug likely caused by a refcount error in a C extension
Python runtime state: finalizing (tstate=0x000000010517e9a0)

Current thread 0x00000001df831000 (most recent call first):
  Garbage-collecting
  <no Python frame>

pepone avatar Feb 06 '24 09:02 pepone

We also got an failure in Ice/operations in CI, probably related

https://github.com/zeroc-ice/ice/actions/runs/7790569493/job/21244716190

 client/amd server [wss]: python.Ice.operations
Traceback (most recent call last):
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 1543, in stop
    process.waitSuccess(exitstatus=exitstatus, timeout=30)
  File "/Users/runner/work/ice/ice/scripts/Expect.py", line 691, in waitSuccess
    self.testExitStatus(exitstatus)
  File "/Users/runner/work/ice/ice/scripts/Expect.py", line 735, in testExitStatus
    test(self.exitstatus, exitstatus)
  File "/Users/runner/work/ice/ice/scripts/Expect.py", line 717, in test
    raise RuntimeError(
RuntimeError: unexpected exit status: expected: 0, got -6


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 2050, in run
    self.runWithDriver(current)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 2081, in runWithDriver
    current.driver.runClientServerTestCase(current)
  File "/Users/runner/work/ice/ice/scripts/LocalDriver.py", line 712, in runClientServerTestCase
    raise failure[0]
  File "/Users/runner/work/ice/ice/scripts/LocalDriver.py", line 693, in stopServerSide
    self.runner.stopServerSide(server, current, success)
  File "/Users/runner/work/ice/ice/scripts/LocalDriver.py", line 204, in stopServerSide
    testcase._stopServerSide(current, success)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 1997, in _stopServerSide
    self.stopServerSide(current, success)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 1909, in stopServerSide
    self._stopServer(current, server, success)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 2015, in _stopServer
    server.stop(current, success)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 1707, in stop
    IceProcess.stop(self, current, waitSuccess and self.waitForShutdown, exitstatus)
  File "/Users/runner/work/ice/ice/scripts/Util.py", line 1559, in stop
    raise RuntimeError(str(ex) + output)
RuntimeError: unexpected exit status: expected: 0, got -6
Fatal Python error: bool_dealloc: deallocating True or False: bug likely caused by a refcount error in a C extension
Python runtime state: finalizing (tstate=0x000000010517e9a0)

Current thread 0x00000001df831000 (most recent call first):
  Garbage-collecting
  <no Python frame>

externl avatar Feb 06 '24 15:02 externl

I am closing this issue because, starting with Python 3.12, True, False, and None are immortal objects. I have already updated the code to avoid using Py_INCREF and Py_DECREF for these immortal objects.

The crash reported here appears to occur during the deallocation of True or False, likely due to an incorrect reference count.

pepone avatar Jul 18 '24 07:07 pepone