XPages HTTP Threads hanging

为君一笑 提交于 2019-12-06 07:36:22
Frantisek Kossuth

Look for locked threads. As I said before, get more information - in your case javadumps will help. Issue server command tell http dump java core (button in browser won't help when http is frozen :-)). This generates javacore file and use IBM Thread and Monitor Dump Analyzer for Java to see the state of every thread.

What you will (probably) find is that threads wait for some Notes API call. Post sample stacktraces of hung threads, please.

I used some of the Java dumps to analyse them for memory leaks and while I found a ton of information in there, not really knowing what I was looking for meant I found no conclusions.

Purely by chance I needed to work with a document in the system that randomly causes these thread locks and I manually ran the Workflow agent that gets called when these documents are processed. It took me a minute to realise what was going on but the agent appeared to be getting stuck in a loop when trying to generate a mime email based on the content of the document.

When a scheduled agent gets stuck in an infinite loop in Domino it's easy to spot just by looking at Agent Manager in the Admin Client. You will see it constantly consuming CPU and never finishing.

When an XPage calls an agent that gets stuck however, there is no clue (at least in my case) that agent manager is running and the HTTP Server task doesn't show that it's doing anything out of the ordinary. This is why I initially thought there were no infinite loops but I was completely wrong!

I added some code to count the number of loops that had been reached in the mime email generator routine and added a break if it reached some arbitrarily high value indicating it was stuck in a loop. Et Voilà! No more hung http threads!

This was a great excuse to go through the entire system and fix some of the old (poor) code in there, and tidy everything up. Ultimately though it was the agent not the xpage that was causing the issue. Thanks for everyone's suggestions though.

There are two actions I strongly recommend:

  • convert your agents into a Java library. This is less work than it sounds and saves you from spinning up the agent runtime every time (a potential source of the hangs)
  • if that's not enough, use a thread it's more work since you need to rethink your notification mechanism

And use Frantisek's insights

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!