duplicate key value violates unique constraint "study_iuid"

347 views
Skip to first unread message

jne...@gmail.com

unread,
Apr 5, 2013, 2:18:22 PM4/5/13
to dcm...@googlegroups.com

Hi,

Occasionally I am seeing some errors in my postgresdb, on receipt of images into dcm4chee, which my searching the forums and the web hasn't been able to help me figure out. Am I correct in interpreting it as some type of concurrency issue, where two instances for the same new study are received at the same time, and both try to create the new study record, with one failing?

What is seen in the postgres and dcm4chee logs is below. Anyone else experiencing something similar?

I have looked at service=StoreScp, and the only thing that looks to be related is "SerializeDBUpdate" which is set to FALSE on my system. The sending system is also a dcm4chee server, which has the MoveScu concurrency set to 4...

Jordan

--------------
Postgres:

2013-04-05 14:16:13 UTC 127.0.0.1 pacsdb ERROR:  duplicate key value violates unique constraint "study_iuid"
2013-04-05 14:16:13 UTC 127.0.0.1 pacsdb STATEMENT:  INSERT INTO study (created_time, updated_time, study_iuid, study_id, study_datetime, accession_no, ref_physician, ref_phys_fn_sx, ref_phys_gn_sx, ref_phys_i_name, ref_phys_p_name, study_desc, study_custom1, study_custom2, study_custom3, study_status, study_status_id, num_series, num_instances, study_attrs, fileset_iuid, fileset_id, ext_retr_aet, retrieve_aets, availability, mods_in_study, cuids_in_study, checked_time, patient_fk, accno_issuer_fk) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30)
2013-04-05 14:16:13 UTC 127.0.0.1 pacsdb ERROR:  current transaction is aborted, commands ignored until end of transaction block
2013-04-05 14:16:13 UTC 127.0.0.1 pacsdb STATEMENT:  SELECT t0_a.pk, t0_a.created_time, t0_a.updated_time, t0_a.study_iuid, t0_a.study_id, t0_a.study_datetime, t0_a.accession_no, t0_a.ref_physician, t0_a.ref_phys_fn_sx, t0_a.ref_phys_gn_sx, t0_a.ref_phys_i_name, t0_a.ref_phys_p_name, t0_a.study_desc, t0_a.study_custom1, t0_a.study_custom2, t0_a.study_custom3, t0_a.study_status, t0_a.study_status_id, t0_a.num_series, t0_a.num_instances, t0_a.study_attrs, t0_a.fileset_iuid, t0_a.fileset_id, t0_a.ext_retr_aet, t0_a.retrieve_aets, t0_a.availability, t0_a.mods_in_study, t0_a.cuids_in_study, t0_a.checked_time, t0_a.patient_fk, t0_a.accno_issuer_fk FROM study t0_a WHERE (t0_a.study_iuid = $1)
2013-04-05 14:16:13 UTC 127.0.0.1 pacsdb ERROR:  current transaction is aborted, commands ignored until end of transaction block
2013-04-05 14:16:13 UTC 127.0.0.1 pacsdb STATEMENT:  SELECT t0_s.pk, t0_s.created_time, t0_s.updated_time, t0_s.series_iuid, t0_s.series_no, t0_s.modality, t0_s.body_part, t0_s.laterality, t0_s.series_desc, t0_s.department, t0_s.institution, t0_s.station_name, t0_s.perf_physician, t0_s.perf_phys_fn_sx, t0_s.perf_phys_gn_sx, t0_s.perf_phys_i_name, t0_s.perf_phys_p_name, t0_s.pps_start, t0_s.pps_iuid, t0_s.series_custom1, t0_s.series_custom2, t0_s.series_custom3, t0_s.num_instances, t0_s.series_attrs, t0_s.fileset_iuid, t0_s.fileset_id, t0_s.src_aet, t0_s.ext_retr_aet, t0_s.retrieve_aets, t0_s.availability, t0_s.series_status, t0_s.mpps_fk, t0_s.study_fk, t0_s.inst_code_fk FROM series t0_s WHERE (t0_s.series_iuid = $1)


server.log:

2013-04-05 14:16:13,740 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4chex.archive.util.CoercionUtils] Coerce (2100,0140) Destination AE,AE,*1,#8,[AE_ORIG ] to (2100,0140) Destination AE,AE,*1,#12,[AE_RECEIVER]
2013-04-05 14:16:13,744 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4chex.archive.ejb.session.StorageBean] inserting instance FileMetaInfo[uid=1.2.392.200036.9107.500.220.10585.20130405.85738.1192.1
2013-04-05 14:16:13,783 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4chex.archive.ejb.entity.PatientBean] Created Patient[pk=16898, pid=10153, issuer=null, name=JOHN,^DOE^^^]
2013-04-05 14:16:13,786 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4chex.archive.ejb.entity.StudyBean] Created Study[pk=23961, uid=1.2.392.200036.9107.500.111058513040500461, patient->ejb/Patient:16898]
2013-04-05 14:16:13,825 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.util.CoercionUtils] Coerce (2100,0140) Destination AE,AE,*1,#8,[AE_ORIG ] to (2100,0140) Destination AE,AE,*1,#12,[AE_RECEIVER]
2013-04-05 14:16:13,831 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.ejb.session.StorageBean] inserting instance FileMetaInfo[uid=1.2.392.200036.9107.500.220.10585.20130405.85441.1191.1
2013-04-05 14:16:13,835 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.ejb.entity.PatientBean] Created Patient[pk=16899, pid=10153, issuer=null, name=JOHN,^DOE^^^]
2013-04-05 14:16:13,837 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4chex.archive.ejb.entity.SeriesBean] Created Series[pk=73541, uid=1.2.392.200036.9107.500.220.10585.2013040508573802.123, study->ejb/Study:23961]
2013-04-05 14:16:13,840 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4chex.archive.ejb.entity.InstanceBean] Created Instance[pk=2466341, iuid=1.2.392.200036.9107.500.220.10585.20130405.85738.1192.1, cuid=1.2.840.10008.5.1.4.1.1.1, series->ejb/Series:73541]
2013-04-05 14:16:13,842 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4chex.archive.ejb.entity.FileBean] Created File[pk=2466339, filepath=2013/4/5/14/D0E5E0E7/A1A914CD/4B2011C1, tsuid=1.2.840.10008.1.2.4.90, filesystem->ejb/FileSystem:14, inst->ejb/Instance:2466341]
2013-04-05 14:16:13,848 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4chex.archive.ejb.session.StorageBean] inserted records for instance[uid=1.2.392.200036.9107.500.220.10585.20130405.85738.1192.1]
2013-04-05 14:16:13,861 ERROR AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCPostgreSQLCreateCommand.Study] Could not create entity
2013-04-05 14:16:13,862 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4cheri.net.FsmImpl] sending [pc-5] 1:C_STORE_RSP
2013-04-05 14:16:13,863 ERROR AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Study#findByStudyIuid] Find failed
2013-04-05 14:16:13,864 ERROR AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Series#findBySeriesIuid] Find failed
2013-04-05 14:16:13,865 WARN  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.ejb.session.StorageBean] inserting records for instance[uid=1.2.392.200036.9107.500.220.10585.20130405.85441.1191.1] failed: Could not create entity:org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "study_iuid"
2013-04-05 14:16:13,866 WARN  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.dcm.storescp.StoreScpService] failed to update DB with entries for received 2013/4/5/14/D0E5E0E7/DA633E60/2B5FEF8B - retry
2013-04-05 14:16:13,866 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.ejb.session.StorageBean] inserting instance FileMetaInfo[uid=1.2.392.200036.9107.500.220.10585.20130405.85441.1191.1
2013-04-05 14:16:13,871 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.ejb.entity.SeriesBean] Created Series[pk=73542, uid=1.2.392.200036.9107.500.220.10585.2013040508544101.122, study->ejb/Study:23961]
2013-04-05 14:16:13,873 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.ejb.entity.InstanceBean] Created Instance[pk=2466342, iuid=1.2.392.200036.9107.500.220.10585.20130405.85441.1191.1, cuid=1.2.840.10008.5.1.4.1.1.1, series->ejb/Series:73542]
2013-04-05 14:16:13,874 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.ejb.entity.FileBean] Created File[pk=2466340, filepath=2013/4/5/14/D0E5E0E7/DA633E60/2B5FEF8B, tsuid=1.2.840.10008.1.2.4.90, filesystem->ejb/FileSystem:14, inst->ejb/Instance:2466342]
2013-04-05 14:16:13,874 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4cheri.net.FsmImpl] received A-RELEASE-RQ
2013-04-05 14:16:13,875 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4cheri.net.FsmImpl] sending A-RELEASE-RP
2013-04-05 14:16:13,878 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.ejb.session.StorageBean] inserted records for instance[uid=1.2.392.200036.9107.500.220.10585.20130405.85441.1191.1]
2013-04-05 14:16:13,882 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4cheri.net.FsmImpl] sending [pc-5] 1:C_STORE_RSP
2013-04-05 14:16:13,894 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4cheri.net.FsmImpl] received A-RELEASE-RQ
2013-04-05 14:16:13,894 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4cheri.net.FsmImpl] sending A-RELEASE-RP
2013-04-05 14:16:13,935 INFO  -> (TCPServer-1-45) [org.dcm4cheri.server.ServerImpl] handle - Socket[addr=/127.0.0.1,port=51012,localport=11112]
2013-04-05 14:16:13,935 INFO  -> (TCPServer-1-45) [org.dcm4cheri.net.FsmImpl] Socket[addr=/127.0.0.1,port=51012,localport=11112]
2013-04-05 14:16:13,936 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-45) [org.dcm4cheri.net.FsmImpl] received AAssociateRQ
2013-04-05 14:16:13,937 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-45) [org.dcm4cheri.net.FsmImpl] sending AAssociateAC
2013-04-05 14:16:13,963 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-34) [org.dcm4cheri.net.FsmImpl] closing connection - Socket[addr=/127.0.0.1,port=51010,localport=11112]
2013-04-05 14:16:13,963 INFO  -> (TCPServer-1-34) [org.dcm4cheri.server.ServerImpl] finished - Socket[addr=/127.0.0.1,port=51010,localport=11112]
2013-04-05 14:16:13,972 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4cheri.net.FsmImpl] closing connection - Socket[addr=/127.0.0.1,port=51011,localport=11112]
2013-04-05 14:16:13,972 INFO  -> (TCPServer-1-43) [org.dcm4cheri.server.ServerImpl] finished - Socket[addr=/127.0.0.1,port=51011,localport=11112]
2013-04-05 14:16:13,975 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-45) [org.dcm4cheri.net.FsmImpl] received [pc-5] 1:C_STORE_RQ with Dataset
2013-04-05 14:16:13,980 INFO  AE_SENDER->AE_RECEIVER (TCPServer-1-45) [org.dcm4chex.archive.dcm.storescp.StoreScpService] M-WRITE file:/opt/dcm4chee-2.17.1-psql/server/default/archive/AE_RECEIVER/2013/4/5/14/D0E5E0E7/4376FE28/4E5A2A9F

Albert Mateu

unread,
Mar 22, 2017, 8:01:47 AM3/22/17
to dcm4che
Hi , I've the same issue. Have you solved? thank you


Gunter Zeilinger

unread,
Mar 22, 2017, 11:10:27 AM3/22/17
to dcm...@googlegroups.com
If a Study is received over multiple associations, two concurrent threads may try to insert a new record for the study in the study table. The Store Service catch the exception and retries the update of the DB:


2013-04-05 14:16:13,866 WARN  AE_SENDER->AE_RECEIVER (TCPServer-1-43) [org.dcm4chex.archive.dcm.storescp.StoreScpService] failed to update DB with entries for received 2013/4/5/14/D0E5E0E7/DA633E60/2B5FEF8B - retry

On Wed, Mar 22, 2017 at 1:01 PM, Albert Mateu <albert...@idi.gencat.cat> wrote:
Hi , I've the same issue. Have you solved? thank you


--
You received this message because you are subscribed to the Google Groups "dcm4che" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dcm4che+unsubscribe@googlegroups.com.
To post to this group, send email to dcm...@googlegroups.com.
Visit this group at https://groups.google.com/group/dcm4che.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages