pydicom / pynetdicom

A Python implementation of the DICOM networking protocol
https://pydicom.github.io/pynetdicom
MIT License
510 stars 180 forks source link

Missing self.socket #806

Open cruigo93 opened 2 years ago

cruigo93 commented 2 years ago

I am facing issue with package and I am still confusing how it was caused. So I cannot reproduce it. But here a screenshot

2022-10-21 14 51 24

It seems that this issue is kinda copy of https://github.com/pydicom/pynetdicom/issues/538 pynetdicom==2.0.2

hzchet commented 11 months ago

:c

scaramallion commented 11 months ago

Whoops, probably a bit overzealous closing this one

jeremygray2 commented 4 months ago

I have a reproducible minimal example, pynetdicom 2.1.0, python 3.11.7, on RHEL 9. (I get a different error with 2.0.2 and python 3.8 on Ubunto 20.04 -- not sure what part matters.)

Say I am on {host} and do: $ python3 -m pynetdicom storescp 11112

From a different host: $ ssh -p 11112 jgray@{host}

Do that 3 times in a row. The 3rd time is usually the charm. I get:

E: Unknown PDU type received '0x53'
E: Unknown PDU type received '0x30'
E: Unknown PDU type received '0x53'
E: Unknown PDU type received '0x32'
E: Unknown PDU type received '0x75'
E: Unknown PDU type received '0x75'
E: Unknown PDU type received '0x30'

E: Unknown PDU type received '0x53'
E: Unknown PDU type received '0x30'
E: Unknown PDU type received '0x53'
E: Unknown PDU type received '0x32'
E: Unknown PDU type received '0x75'
E: Unknown PDU type received '0x75'
E: Unknown PDU type received '0x30'

E: Unknown PDU type received '0x53'
E: Unknown PDU type received '0x30'
E: Unknown PDU type received '0x53'
E: Unknown PDU type received '0x32'
E: Unknown PDU type received '0x75'
E: Unknown PDU type received '0x75'
E: Unknown PDU type received '0x30'
E: State Machine received an exception attempting to perform the action 'AA-7' while in state 'Sta13'
E: 'NoneType' object has no attribute 'send'
Traceback (most recent call last):
  File "/home/jgray/.venv/mxpy/lib64/python3.11/site-packages/pynetdicom/fsm.py", line 91, in do_action
    next_state = action[1](self.dul)
                 ^^^^^^^^^^^^^^^^^^^
  File "/home/jgray/.venv/mxpy/lib64/python3.11/site-packages/pynetdicom/fsm.py", line 978, in AA_7
    dul._send(A_ABORT_RQ(primitive))
  File "/home/jgray/.venv/mxpy/lib64/python3.11/site-packages/pynetdicom/dul.py", line 456, in _send
    self.socket.send(pdu.encode())
  File "/home/jgray/.venv/mxpy/lib64/python3.11/site-packages/pynetdicom/transport.py", line 433, in send
    nr_sent = self.socket.send(bytestream[total_sent:])
              ^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'send'
Exception in thread Thread-5 (run_reactor):
Traceback (most recent call last):
  File "/usr/lib64/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/home/jgray/.venv/mxpy/lib64/python3.11/site-packages/pynetdicom/dul.py", line 444, in run_reactor
    self.state_machine.do_action(event)
  File "/home/jgray/.venv/mxpy/lib64/python3.11/site-packages/pynetdicom/fsm.py", line 91, in do_action
    next_state = action[1](self.dul)
                 ^^^^^^^^^^^^^^^^^^^
  File "/home/jgray/.venv/mxpy/lib64/python3.11/site-packages/pynetdicom/fsm.py", line 978, in AA_7
    dul._send(A_ABORT_RQ(primitive))
  File "/home/jgray/.venv/mxpy/lib64/python3.11/site-packages/pynetdicom/dul.py", line 456, in _send
    self.socket.send(pdu.encode())
  File "/home/jgray/.venv/mxpy/lib64/python3.11/site-packages/pynetdicom/transport.py", line 433, in send
    nr_sent = self.socket.send(bytestream[total_sent:])
              ^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'send'
scaramallion commented 3 months ago

Thanks @jeremygray2