Enet4 / dicom-rs

Rust implementation of the DICOM standard
https://dicom-rs.github.io
Apache License 2.0
428 stars 82 forks source link

Regression when gathering worklist from OrthanC #604

Open qarmin opened 14 hours ago

qarmin commented 14 hours ago

I bisected that since

31408225ec129d0f7ef4bee49afe10a7714110ee 3251368e622a385de3a01a5581f5bb730187d902 b8d82002cbadf8603320bc2166c320b9e83a330c 1f79816dcb57781c0666e07bd3a3619f4c8497bd

(I'm not sure, because all these commits fails to build)

I'm having such error, when gathering first worklist item

2024-11-25T13:32:07.969320Z DEBUG dicom_findscu: Operation pending: ff00
2024-11-25T13:32:07.983659Z ERROR dicom_findscu: Failed to read response data

Caused by this error:
  1: Incoming pdu was too large: length 151126016, maximum is 131072
qarmin commented 14 hours ago

I suspect that error is here - pdu_length seems to have decoded invalid value:

https://github.com/Enet4/dicom-rs/blob/e81a438d05540371fe24a2fd9dc4a442ed761fd2/ul/src/pdu/reader.rs#L34-L55

qarmin commented 13 hours ago

There is difference between received buf and pdu_length

this is shown as hex buf 0.7.1

0200
0400
0600
0200
0400
0400
0400
0400
0400
0400
0400
0400
0400
0400
0400
0600

buf 0.8.0

0200
0400
0400
0600
0200
0400
0000
0400

pdu_length 0.7.1

ba
58
04
ba
58
b0
58
8c
58
8c
58
b0
58
90
58
04

pdu_length 0.8.0

ba
58
58
04
ba
58
9020000
b0

looks that 3 pdu is duplicated in 0.8.0 and different that in 0.7.1

Enet4 commented 12 hours ago

Thank you for reporting. Those commits come from async support in #542. It may be helpful to have some steps and code to reproduce this issue.

qarmin commented 8 hours ago

This also happens with wlmscpfs Steps to reproduce

sudo apt install dcmtk
mkdir -p ~/test/worklist/a

// TODO copy worklist files to ~/test/worklist/a
// "a" name is important, because it needs to be same as called-ae-title

sudo wlmscpfs --data-files-path ~/test/worklist 11111 -d
cargo run -- 127.0.0.1:11111 --calling-ae-title "a" --called-ae-title "a" --mwl -q PatientName

shows error

2024-11-25T18:49:49.192714Z ERROR dicom_findscu: Failed to read response data

Caused by this error:
  1: Incoming pdu was too large: length 33554432, maximum is 131072

version 0.7.1

dicom-findscu 127.0.0.1:11111 --calling-ae-title "a" --called-ae-title "a" --mwl -q PatientName

shows properly

(0010,0010) PatientName                  PN (1, 12 bytes): "Brown^Perry"
------------------------ Match #79 ------------------------
(0010,0010) PatientName                  PN (1, 12 bytes): "Johnson^Dora"
------------------------ Match #80 ------------------------
(0010,0010) PatientName                  PN (1, 14 bytes): "Green^Chester"
------------------------ Match #81 ------------------------
(0010,0010) PatientName                  PN (1, 10 bytes): "Evans^Adam"
------------------------ Match #82 ------------------------
(0010,0010) PatientName                  PN (1, 14 bytes): "Reed^Florence"
------------------------ Match #83 ------------------------
(0010,0010) PatientName                  PN (1, 10 bytes): "Diaz^Ellen"
------------------------ Match #84 ------------------------
(0010,0010) PatientName                  PN (1, 12 bytes): "Hall^Estella"
------------------------ Match #85 ------------------------
(0010,0010) PatientName                  PN (1, 12 bytes): "Allen^Grace"
------------------------ Match #86 ------------------------
(0010,0010) PatientName                  PN (1, 14 bytes): "Murphy^Wesley"
------------------------ Match #87 ------------------------
(0010,0010) PatientName                  PN (1, 14 bytes): "Wilson^Carrie"
------------------------ Match #88 ------------------------
(0010,0010) PatientName                  PN (1, 12 bytes): "Evans^Viola"

Worklist files to unpack to ~/test/worklist/a folder(~150 worklist files - 2 for each day starting from today) - files.zip

naterichman commented 8 hours ago

I'll try to dig into this

naterichman commented 7 hours ago

@qarmin Could you try off of this branch? https://github.com/naterichman/dicom-rs/tree/fix-read-buffer