Skip to content

Fix Monitor Webpage Initialization

Dylan Oliver Teague requested to merge bugfix/monitoring_init_webpage into develop

Description

The monitoring webpage is not made to be thread safe. The class that makes the rpc request is DaqMonitor, so the ShelfMonitor class initializes 12 for each AMC and puts them into a vector (v_daqmon). The ShelfMonitorWeb uses this vector of AMC information to create the webpage in a different thread. Because there is not interface between the threads, the webpage only is partially made before the function call errors out, thus giving the broken HTML page as in the issue below.

To make this "semi-threadsafe", we can exploit the fact that the vector of DaqMonitor objects is of size 12, we can just wait till v_daqmon.size == 12 to unhalt the webpage creation. This leads to effectively threadsafe code without using mutex.

As raised in the issue, this will hopefully be improved on with a new web interface, but this allows for midterm fix for the annoying problem

Related Issue

Related issue #36 (closed) goes over the main problems

Screenshots

output sped up x3, but gives idea of what lock does

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Merge request reports