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

PACSservice state instability #20

Open
jennydaman opened this issue Oct 26, 2022 · 1 comment
Open

PACSservice state instability #20

jennydaman opened this issue Oct 26, 2022 · 1 comment
Labels

Comments

@jennydaman
Copy link
Contributor

jennydaman commented Oct 26, 2022

pfdcm occasionally "forgets" its registered PACSservices. I am running a script to observe this issue.

#!/bin/bash -ex

while true; do
  sleep 1
  printf "%-30s| %s\n" "$(date --rfc-3339=s)" "$(curl -s http://rc-golden.tch.harvard.edu:30031/api/v1/PACSservice/list/)" >> poll.log
done

Here's the actual output:

2022-10-26 14:49:57-04:00     | ["default"]
2022-10-26 14:49:58-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:49:59-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:00-04:00     | ["default"]
2022-10-26 14:50:01-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:02-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:03-04:00     | ["default"]
2022-10-26 14:50:04-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:05-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:06-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:07-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:08-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:09-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:10-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:11-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:12-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:14-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:15-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:16-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:17-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:18-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:19-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:20-04:00     | ["default","PACSDCM"]
2022-10-26 14:50:21-04:00     | ["default","PACSDCM"]
2022-10-26 14:50:22-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:23-04:00     | ["default"]
2022-10-26 14:50:24-04:00     | ["default"]
2022-10-26 14:50:25-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:26-04:00     | ["default","orthanc","PACSDCM"]
2022-10-26 14:50:27-04:00     | ["default","orthanc","PACSDCM"]

Expected: every line should have all three of ["default","orthanc","PACSDCM"]

About 27% failure rate.

@jennydaman jennydaman added the bug label Oct 26, 2022
@jennydaman
Copy link
Contributor Author

jennydaman commented Oct 27, 2022

Related to #18 , #19

https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker#-warning-you-probably-dont-need-this-docker-image

Currently, pfdcm's state is held in-memory, but there are multiple Python processes spawned off by the base image's configuration of gunicorn, each with their own "in-memory database." A different process is handling each response.

Workaround: define container's command manually as uvicorn main:app --host 0.0.0.0 --port 4005

apiVersion: apps/v1
kind: Deployment
metadata:
  name: pfdcm
  labels:
    app: pfdcm
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pfdcm
  template:
    metadata:
      name: pfdcm
      labels:
        app: pfdcm
    spec:
      containers:
        - name: pfdcm
          image: ghcr.io/fnndsc/pfdcm:2.8.3
          command:
            - "uvicorn"
            - "main:app"
            - "--host"
            - "0.0.0.0"
            - "--port"
            - "4005"
          ports:
            - name: http
              containerPort: 4005
          volumeMounts:
            - name: state
              mountPath: /home/dicom
      volumes:
        - name: state
          persistentVolumeClaim:
            claimName: home-dicom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant