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
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
Metadata Update from @rcritten:
- Issue set to the milestone: FreeIPA 4.7.1 (was: FreeIPA 4.7)
FreeIPA 4.7 has been released, moving to FreeIPA 4.7.1 milestone
to comment on this ticket.