To give a brief run-through of the issue, it occurred in one of our implementations where a CHW noted that tasks that should have been generated in her account were not visible. So, I went through the motions to get to the root of the problem & finally landed on the CouchDB database. Here, I ran into the bug, which you can see in the picture below:
I have not seen a bug such as this in any implementation previously. Few more things that I would like to add for more context:
- I can access the same task generated by the same user from the medic API
- Task generated from the same report but from a different account works perfectly in both the medic app and CouchDB
- Same error occurs in all other tasks created from this user account
There is nothing peculiar about this user account that could be causing this kind of bug but all the errors seems to revolving around it.
This is a live production server, so if anyone has faced this issue before and knows how to fix it, please let me know immediately.
TLDR; Tasks are not generating for one specific user account, where there is no overt or apparent difference from other user accounts. Traced the issue back to the CouchDB server and ran into the exception shown in the image above. Same task generates in other user accounts perfectly and can be seen on CouchDB without errors.
cc: @sanjay @binod @yuv
Hi @gkesh ,
For the user that’s having a problem, is there any message in Tasks tab? Is it just a blank or there is any error message shown?
You mentioned you can access task from API, but on On TLDR, you mentioned
Tasks are not generating for one specific user account
Just to understand the problem better, Are tasks not generated for her or tasks are generated but not appeared?
If tasks are no generated, can you paste your task definition? If tasks are generated but not appearing and you can get from API, can you check it’s state and state history on that document?
Sorry about the confusion, please let me clarify.
The tasks are not being displayed in the CHT application and also when accessing the task from CouchDB the error in the screenshot appears.
The task being generated has the state “Ready”.
The task does not appear at all. You can see the task from same report in another CHW’s account but in this CHW’s phone, we cannot see it. For additional context, we did ask her to restart the application, the device and retry sync. The last resort left is to clear up the data and relogin.
Thanks for clarification @gkesh. How many documents does this user have ? Can you try logging in using her credentials in another device or chrome browser? If you’re able to login on the browser, can you also check the console at the same time ?
The user has upwards of 15,000 documents, so it will take a bit to login and test it. I will consult my team and see if there are devices already logged in but most probably there isn’t.
I will try logging in on a chrome browser but in the meantime, is there any other steps I can take to get to the bottom of this error besides looking at docker logs?
Hi @gkesh , If the device with a problem is with you, can you check logs using either of two methods mentioned here? If you see same problem on other device at your disposal or on your browser, you can follow the same approach and look at log in detail.
If you can download through API, you can also check in your editor and determine if there’s any anomaly. Also, is it possible for you to mask any personally identifiable information on the document causing problem and post here so that we can also look at ?
I have seen this error before in CouchDB Fauxton before when I was trying to access a document with conflict. I suggest you follow these steps to check if that’s the case:
- Check if your database has any conflicting documents. You can do this quickly by looking at the
api/v2/monitoring endpoint where you can see the count of conflicting documents. For example:
- If there are any conflicting documents reported above, you can see them in the
medic-conflicts/conflicts/ view. For example:
- If the task document you are checking above is in the list, please follow this guide to work towards resolving the conflict and see if the error goes away.
Thank you @binod sir, there are some conflicts in the couchdb database and as you said, we believe it might be the reason for the crash. We are working on fixing the conflicts but due the large volume of conflicts, it might take a decent chunk of time to get a definitive answer.
As per your instruction, we went to this URL in our instance and found the conflicts all listed out. Although, when trying to open the conflict document, we get the same error as the task document, we believe we have enough information on the table itself that we can comfortably go through the diagnosis and repair process.
We will follow the linked document closely and keep this thread updated with the latest developments on this situation.
cc: @yuv @sanjay @nitin @niraj
Just to update everyone on this situation, the issue occurred due to the contact for that specific user being deleted. This was purely a user error and not something related to the conflicting documents in the system. Although, how the user contact got deleted is still a mystery, the error has been solved for now by creating a new contact in the appropriate hierarchy.