NeonGeckoCom / skill-alerts

Alerts Skill Repository
Other
5 stars 7 forks source link

[BUG] RuntimeError: dictionary changed size during iteratio #130

Closed goldyfruit closed 10 months ago

goldyfruit commented 1 year ago

Description

Got this trace after restarting ovos-core.

2023-08-31 18:42:10.419 - skills - ovos_core.intent_services.padatious_service:_register_object:204 - DEBUG - Registering Padatious intent: skill-alerts.neongeckocom:list_alerts.intent
2023-08-31 18:42:10.435 - skills - ovos_core.intent_services.padacioso_service:_register_object:165 - DEBUG - Registering Padacioso intent: skill-alerts.neongeckocom:list_alerts.intent
Exception in thread Thread-17 (train):
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/home/ovos/.venv/lib/python3.11/site-packages/padatious/training_manager.py", line 95, in train
    train(i)
  File "/home/ovos/.venv/lib/python3.11/site-packages/padatious/training_manager.py", line 26, in _train_and_save
    obj.train(data)
  File "/home/ovos/.venv/lib/python3.11/site-packages/padatious/intent.py", line 79, in train
2023-08-31 18:42:11.143 - skills - ovos_core.intent_services.padatious_service:_register_object:204 - DEBUG - Registering Padatious intent: skill-alerts.neongeckocom:quiet_hours_end.intent
2023-08-31 18:42:11.150 - skills - ovos_core.intent_services.padacioso_service:_register_object:165 - DEBUG - Registering Padacioso intent: skill-alerts.neongeckocom:quiet_hours_end.intent
2023-08-31 18:42:11.193 - skills - ovos_core.intent_services.padacioso_service:_register_object:165 - DEBUG - Registering Padacioso intent: skill-alerts.neongeckocom:quiet_hours_start.intent
    i.train(train_data)
  File "/home/ovos/.venv/lib/python3.11/site-packages/padatious/pos_intent.py", line 88, in train
    i.train(train_data)
  File "/home/ovos/.venv/lib/python3.11/site-packages/padatious/entity_edge.py", line 112, in train
    add_sents(train_data.other_sents(self.intent_name), lambda x: 0.0)
  File "/home/ovos/.venv/lib/python3.11/site-packages/padatious/entity_edge.py", line 103, in add_sents
2023-08-31 18:42:11.264 - skills - ovos_core.intent_services.padatious_service:_register_object:204 - DEBUG - Registering Padatious intent: skill-alerts.neongeckocom:quiet_hours_start.intent
    for sent in sents:
  File "/home/ovos/.venv/lib/python3.11/site-packages/padatious/train_data.py", line 50, in other_sents
    for name, sents in self.sent_lists.items():
RuntimeError: dictionary changed size during iteration
2023-08-31 18:42:11.309 - skills - ovos_core.intent_services.padatious_service:train:144 - INFO - Training complete.

I'm using the latest code for this skill.

Steps to Reproduce

No response

Relevant Code

No response

Other Notes

No response

builderjer commented 1 year ago

I have had recent issues with this skill vs ovos version on ovos. Can't remember the exact issue but I'll try again and try to reproduce

JarbasAl commented 1 year ago

padatious is not thread safe, this can happen if several skill load at same time (only external skills not loaded by ovos-core directly), skills can not register intents while padatious is training (one of the other reasons we want to ditch padatious). But i am curious where the source of the bug is since we should have locks in the relevant places

if this is indeed the issue, the bug report belongs in ovos-core and should happen with other skills too