How to fix a corrupted sync record xml?

I am having a synchronization issue similar to the one explained in the Sync Module Bug Blog - BUG : A sync record fails to import because the xml of the record got corrupted during the creation of the record

The issue is I didn’t understand the example and solution suggested in the blog. For instance, it’s mentioned that : An example record looks like this: (…check line #29 where the owner tag is ’ < owner type = "recreate" ></ owner > ')

What’s wrong with that exactly? What is the correct form? Or what should be corrected exactly?

So my scenario is:

  • OpenMRS v 1.11.7; Sync Module v 1.3
  • I have 1 parent and many child servers. What’s happening: A specific child server successfully synchronizes to the parent server, but then this data fails to synchronize to other child servers. And I get the error-> ERROR - NOT SYNCHRONIZED, WILL RETRY

And here the Tomcat log. I would send the link to the payload but I can only send 2 links!

Thank in advance

1 Like

@rubailly @mogoodrich could you be having any comments on this? :slight_smile:

Hi, some additional info. Please find bellow the payload from the child and parent server:

  • I have here the payload of the child server.
  • And here the payload on the parent server

Should the payload on the parent server be exactly the same from the payload of the child server?


Hello @rubailly and @mogoodrich any hint on this issue? Thanks

@emabotta -See that line in the stack trace where it says Column ‘patient_id’ cannot be null …can you first check if the patient/person in the payload exists on the other child servers?

run select * from person where uuid = “0baed48d-49a6-4acd-ae93-95e2fd3abbe_c”; on one of the child servers and see if you get any results.

@rubailly - Yes I noticed, I thought it would create the patient. Answering your question - no I don’t get any results. The patient doesn’t exist on the child server.

@rubailly is the patient supposed to already exist on the child server? It is a new patient that was created on a child server, which was then successfully synchronized to the parent server. But is now failing to synchronize to another child server! Am I missing something in my understanding of the synchronization process?

Yes, the patient has to be in the database on the destination server, otherwise, the record will fail as it won’t know which person/patient it should be attached/linked to. The problem is even the other records that are pending and related to this patient will fail as well. Can you run select * from sync_record where payload like “%0baed48d-49a6-4acd-ae93-95e2fd3abbe_c%” and state=“NEW” on the parent server and see how many records do you have in the queue for that patient?

I have 2 records. Do you have any idea how it worked in the first synchronization, from the child to the parent? This patient was created on a child server. The same happens with many other patients that are created on other child servers!!


If it worked for the parent server, that means it already had that patient. How did you create the other child servers? Maybe you created them from a database that didn’t have all the patients…