Urgent: DHIS2 keeps creating ProgramStageDataElement without DataElement

Dear Community,

Our production (2.30, build: ee4cb99) is facing a strange issue which is preventing users from accessing Event forms in Tracker capture.

We cannot open entry form in Tracker capture anymore. Nor we can open “Assign Data Elements” and “Create Data Entry Form” sections in Program Maintenance. The error is:

Uncaught TypeError: Cannot read property 'domainType' of undefined
at AssignDataElements.js:256

I have a bit of JS background, so here is what I’ve been able to figure out:

The code where error occurs:

/* Fix for DHIS2-4369 where some program stages may contain other dataelements than TRACKER
This is due to a database inconsistency. This fix makes it possible to show and be able to remove these
elements from the UI.
itemStore needs to be a superset of all assigned items, so we add the items that are assigned,
but may not be in prop.trackerDataElements  */
const otherElems = props.model.programStageDataElements
    .filter(({ dataElement }) => (
        dataElement.domainType !== "TRACKER" && !dataElementIds.has(dataElement.id)
    ))
    .map(({ dataElement }) => ({
        id: dataElement.id,
        text: dataElement.displayName,
        value: dataElement.id,
    }));   

For one of the programStageDataElement that the code is looping over, there exists one without corresponding dataElement attached to it, and thus “dataElement” becomes undefined.

The offending programStageDataElement is:

<programStageDataElement lastUpdated="2019-04-28T17:07:55.268" id="dNpwdrfbxji" created="2019-04-28T17:07:55.268">
<displayInReports>false</displayInReports>
<skipSynchronization>false</skipSynchronization>
<externalAccess>false</externalAccess>
<renderOptionsAsRadio>false</renderOptionsAsRadio>
<allowFutureDate>false</allowFutureDate>
<compulsory>false</compulsory>
<allowProvidedElsewhere>false</allowProvidedElsewhere>
<sortOrder>46</sortOrder>
<favorite>false</favorite>
<access>
<read>true</read>
<update>true</update>
<externalize>true</externalize>
<delete>true</delete>
<write>true</write>
<manage>true</manage>
</access>
<programStage id="YECy5jC9Sre"/>
</programStageDataElement>

This DHIS2-4369 is the similar issue we’re facing. One of the comment said that it worked after deleting the offending programStageDataElement. So, we deleted that programStageDataElement.

It opened once or twice after that, and we had to reassign some data elements again. Then, after saving, a new programStageDataElement without dataElement is created again. Deleting it again deletes lots of other programStageDataElements. Tried reassigning again, and after save, the problem occured again.

Our users have been unable to enter lab results since today. Please let me know if I can provide any more information. We recently upgraded the WAR file to this build (ee4cb99), and it seems to have fixed our previous memory leak issue.

@dhis2-backend

2 Likes

Update: We went back to build “2ecc8ef”, restored the metadata and the issue is gone for now.

Hi @Aatish_Neupane,

I am tagging the @dhis2-tracker team to have a look at this issue for future builds.

Best,
James.

1 Like

@Stian and @Markus could you have a look at this issue?

2 Likes

Dear All, (@dhis2-tracker @dhis2-backend @Stian @Markus)

We are using DHIS2 2.30 in production server for National Tuberculosis Program Nepal. As we faced critical memory leakage, we had to upgrade to build: ee4cb99. This build solved memory leak issue but it keeps creating program stage data element without data element.

On behalf of National Tuberculous Program Nepal, I request you all to look into this issue.

Kind Regards,
Naval Shrestha
National Tuberculosis Center, Nepal

2 Likes

@Naval Is there a jira issue with some description/steps to reproduce for the issue you mentioned? Would certainly help us if we can reproduce your issue in the latest 2.30 build.

1 Like

@Naval @Aatish_Neupane

Do this happen to newly create Programs or update existing ones ?

Could you check if the issue is reproducible on https://play.dhis2.org/2.30 ? I tried but couldn’t produce it, so if you could please provide the steps.

Could you also check if those users have access to those Data Elements ? ( check sharing settings )

1 Like

It only happens when updating existing one. We couldn’t replicate that on demo instance. So, we’re setting up a test instance for you. Will share it with you when done.

1 Like