Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: accessing a multikey may lead to IndexError (methods getOne() or get() ) #359

Closed
1 of 2 tasks
a-kleinf opened this issue Apr 22, 2024 · 0 comments · Fixed by #361 or #360
Closed
1 of 2 tasks

bug: accessing a multikey may lead to IndexError (methods getOne() or get() ) #359

a-kleinf opened this issue Apr 22, 2024 · 0 comments · Fixed by #361 or #360
Assignees
Labels
bug Something isn't working v1 Version 1 is affected v2 Version 2 is affected

Comments

@a-kleinf
Copy link
Collaborator

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

(issue was observed with sdc11073 v1 but is also relevant for v2)

When accesing a multikey, at the same time as it is updated, an IndexError may occure.

File "....", line 349, in _check_alarm_activation_state
alert_state = self.mdib.states.descriptorHandle.getOne(alert_condition, allowNone=True)
File "...\lib\site-packages\sdc11073\multikey.py", line 52, in getOne
return result[0]
IndexError: list index out of range

in multikey.py
if a state update is triggered class MultiKeyLookup -> updateObject() is called and following code is executed:

with self._lock:
    self._rmIndices(obj)
    self._mkIndices(obj)

if getOne or get is called between self._rmIndices(obj) and self._mkIndices(obj) the IndexError may occure.
The instance of self._lock should be also used in getOne or get

Expected Behavior

Minimal Reproducible Example

No response

Solution proposal

No response

Python Version

3.10.11

Operating system

win32

Sdc11073 Version

1.3.0

Link to sdc11073 Logs

No response

Further Information

No response

Participation

  • I am willing to submit a pull request to fix this bug.
@a-kleinf a-kleinf added bug Something isn't working v1 Version 1 is affected v2 Version 2 is affected labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v1 Version 1 is affected v2 Version 2 is affected
Projects
None yet
2 participants