Problem Loading HTML forms

We have had issues with html forms loading as discussed in HTML Forms Taking Too Long to Display thread. Recently we have started to notice that whenever form loading exceeds a certain amount of time usually more than 30 seconds the user is redirected to home page. We are wondering whether this is an expected behavior?! Is there somewhere one can set a timeout or is this a general OpenMRS configuration issue?

@mogoodrich and @darius I think I have to call you guys to this thread.

Hi Willa,

Can you share a yourkit snapshot of loading the form? Clearly something is going wrong, and it must be related to something on the AMPATH database and forms that isn’t present in PIH’s setups.

When I attach yourkit I can not even load the form. The moment I do that and try to load the form, it times out and redirect to the homepage. It is quite challenging actually. I suspect it might be caused by connectivity also because I am connecting from U.S to Kenya and sometimes the connection is quite shaky.

Can you set up a dev environment with this form, and a copy of the metadata portion of the AMPATH database?

The reason I have to debug on AMPATH servers is because the form loads pretty fast on our test environment. So the same form loaded from our test server loads fast enough but when taken to production it takes forever. We do suspect it might be a data issue and that is why I was trying to understand how and where the process tries to access the database tables when the form is being loaded.

Hi Willa,

If you can’t use the profiler, one workaround is to compile a custom build of the HTML Form Entry module where you put some timing statements around these calls to handler.doStartTag and handler.doEndTag in HtmlFormGenerator, and log the time taken.

In fact, it would be a generally nice feature if when you turned it on, it recorded timing information in FormEntrySession, and logged this. But for your purposes you can just hack it once rather than making it a generic feature. :slight_smile:

@darius this is just a feedback in case you might have some thoughts. I put some timing statement and it appears the section taking long is in EncounterDetailSubmissionElement Class starting from line 129 to 272.

Hi Willa,

Do you have lots of providers in the system?

Are you using the tag? You should be. If you use the old tag which is from before OpenMRS 1.9, I think there’s some compatibility stuff that needs to happen and slows things down.

(I don’t remember if there’s a way to have an autocomplete for providers, rather than preloading them all – that might be faster.)

We have 2300+ providers and yes we are using the tag. Is there some new tag that provide this functionality for 1.9 and above?

Willa & Darius–

Hmm… this rings a bell now–I do remember some sort of slowdown when the provider list got very large. Would be curious to know how many providers you have in the system.

Looking at the code, there does appear to an autocomplete, but, I don’t think it will help you because I don’t think it uses AJAX–rather it just creates an autocomplete from a list of predefined options.


Yep, if you have 4000+ providers that sounds like a problem, because it would be generating a 4000+ entry dropdown… Are the majority of them active/not-retired?

The new tag to use would be the encounterProviderAndRole tag provided by the HFE 19ext module. However, I don’t that is going to solve your ultimate problem. If you need to chose between that many providers, I think you are going to need to build autocomplete functionality into this new tag, which I don’t think currently exists.

Take care, Mark