#7252 Replace __del__ with context manager
Opened 2 years ago by cheimes. Modified 2 years ago

We must not use __del__ for cleanup. It is not reliable and causes exceptions like

AttributeError: "'LocalHSM' object has no attribute 'p11'" in <bound method="" LocalHSM.__del__="" of="" <ipaserver.dnssec.localhsm.LocalHSM="" object="" at="" 0x7f7325688650="">> ignored

when a process ends. ipa-dnskeysync-replica fails here because Python has already destroyed most of the world before it runs del. All occurences of __del__ must be replaced with a proper context manager (__exit__ and __enter__).


@cheimes could you please provide steps to reproduce the issue?

Metadata Update from @frenaud:
- Issue set to the milestone: FreeIPA 4.7

2 years ago

The LocalHSM issue mentioned in description has a manual fix described in #4967. This one is to prevent it.

Metadata Update from @pvoborni:
- Issue priority set to: normal
- Issue tagged with: robustness

2 years ago

Metadata Update from @rcritten:
- Issue set to the milestone: FreeIPA 4.7.1 (was: FreeIPA 4.7)

2 years ago

FreeIPA 4.7 has been released, moving to FreeIPA 4.7.1 milestone

Login to comment on this ticket.

Metadata