ISISNeutronMuon / ISISNeutronMuon/HLM_PV_Import

HLM Manager sometimes spawning new Main Window processes on PV conn. check (caproto read)

Open
#1 1 comment 0 reactions 0 assignees View on GitHub
bug Manager
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### Description
In a packaged app with PyInstaller (either onefile or dir), for each caproto `read` call, a new app process would spawn. For example, if 4 PV names were given and "Check PVs" button clicked, after a short while, four different manager main windows (each with its own process) would appear on top of each other.

This will happen for each PV that is tested, thus each caproto.sync.client `read` call, even though only one QThread is responsible for testing the PVs.

### Notes
This may be caused by a weird interaction between PyInstaller's frozen code handling of multithreading/multiprocessing (?) and caproto (sync client).

Issue encountered first on NDAHEMON, then on personal desktop as well.
Bug was never encountered on developer machine (IDE or packaged app).

To see if this is a compatibility issue with NDAHEMON or with the .exe, ran the app on personal machine and issue was encountered again, so it is not an issue with NDAHEMON.

### Personal machine fix (?)
After encountering the issue on the personal machine as well, downloaded code from the git repository, installed modules from requirements.exe, ran the HLM Manager with PyCharm IDE - no issues.
Closed PyCharm, uninstalled all packages from requirements from Python.
Ran packaged .exe from before - no issues: Somehow the issue was fixed on the personal desktop by fetching the code and running it via PyCharm IDE.

### NDAHEMON fix (?)
Enabled gateway from work machine NDW2123, so that NDAHEMON can read PVs for the time being (until the IOC is set-up on it as well).
Added work machine's IP to NDAHEMON's EPICS_CA_ADDR_LIST. Tested it can connect to PVs using `caget TE:NDW2123:HA:HLM:MOTHER_DEWAR:HE_LEVEL`, it worked.

After these steps, the issue was somehow resolved on NDAHEMON as well - a new process no longer spawns on caproto read.

### How to reproduce
Because the issue somehow resolved itself, the cause is uncertain.
To attempt reproduce, simply run the HLM Manager .exe, set up the DB Connection in settings, open ConfigEntry window by clicking the New/Add Config button on left of the PV Config table, write some PV names (or anything) in the Measurement PVs fields, then click the PV Connection Check button.
If establishing a HLM DB connection is not possible, remove the return statement from `new_config_btn_clicked` in `ServiceManager\GUI\main_window.py` (to be able to open the ConfigEntry dialog) then re-freeze with PyInstaller.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the packaged HLM Manager executable and following the reproduction steps for the PV Connection Check. Read ServiceManager\GUI\main_window.py, especially new_config_btn_clicked, and inspect how the caproto read calls behave under PyInstaller. Done means repeated PV checks no longer spawn additional manager windows or processes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.