Multithreaded access error when validating fields

Open
#32 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start in epicsdbbuilder/dbd.py by reading ValidateDbField and ValidateFieldValue, including the DBEntry cursor use around the reported line 91. Reproduce the intermittent failure through the multithreaded validation exercised by PythonSoftIOC's scheduled testing, and confirm the work is done when concurrent validation no longer produces the reported fldDes-not-found assertion.

Written by the indexing model from the issue text.

Description

It seems that part(s) of epicsdbbuilder are not threadsafe. Inside of ValidateDbField is a single DBEntry item, which is used as a cursor into a database. However, inside the ValidateFieldValue method, which can be called from multiple threads simultaneously, the cursor gets re-used for multiple invocations.

This has the end result of creating an error message like this:

AssertionError: Can't write "@PV-FROM-CM" to field OUT: fldDes not found

Which comes from this line.

This was originally spotted in PythonSoftIOC's scheduled testing, where this error message very occasionally appears during scheduled testing. See this issue.

Dominant language
Python
Stars
9
Forks
7
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DiamondLightSource/epicsdbbuilder

All issues in DiamondLightSource/epicsdbbuilder

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.