ronny-rentner / UltraDict

Sychronized, streaming Python dictionary that uses shared memory as a backend
Apache License 2.0
267 stars 25 forks source link

AttributeError: data when updating nested UltraDicts #28

Closed Rickkert00 closed 10 months ago

Rickkert00 commented 10 months ago

Hi @ronny-rentner,

I am trying to use nested UltraDicts to communicate between processes. The information flow is structured as follows:

Because of design limitations it is not possible to have the information flow into ultra_dict directly. I expect that I should be able to call ultra_dict.update(info) consecutively, even if the information in info has not changed. There is another process that is reading the information out of ultra_dict.

Is this expected behaviour? If so, how should I update the UltraDict such that information is correctly passed through to the other process?

Code to reproduce the issue:

ultra_dict = UltraDict(recurse=True)
info = {'data': {'example': 0}}
ultra_dict.update(info)
print(ultra_dict)
info['data']['example'] = 1
ultra_dict.update(info)
print(ultra_dict)
info['data']['example'] = 2
ultra_dict.update(info)

Python version: 3.8.10 UltraDict version: 0.0.6

ronny-rentner commented 10 months ago

Hi, thanks for your report. Unfortunately there was a bug in the cleanup code and the nested UltraDicts were cleaned up too eagerly. This bug has been fixed in the main branch but the fix was not released yet. I'll do that shortly. Would you be able to try the main branch and see if the issue goes away?

Rickkert00 commented 10 months ago

After updating to the main branch the issue has been resolved! Thank you!