Issue
- When I analyze a thread dump there are multiple threads in BLOCKED status with stacktraces such as this:
"http-nio-8080-exec-129" Id=325 BLOCKED on com.liferay.portal.init.servlet.filter.internal.InitFilter@4334dad owned by "http-nio-8080-exec-130" Id=326
at com.liferay.portal.init.servlet.filter.internal.InitFilter.processFilter(InitFilter.java:51)
- blocked on com.liferay.portal.init.servlet.filter.internal.InitFilter@4334dad
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
...
Environment
- Liferay DXP 7.0+
Resolution
- When starting the server, even though the aplication server and DXP web application startup has completed, there are some resources that are lazily initialized upon receiving the first request. This caused that, if many requests were received at once before this first request is answered, errors were shown in the log because these resources had not yet been initialized.
To avoid generating these errors, the initFilter was developed that only lets the first request pass (triggering this initialization of resources) and blocks the remaining requests until this first one is answered.
For this reason it is always recommended, before external traffic reaches the node, to send first a warm-up request and then expose the node to external traffic. This way these blocks will be avoided if a large number of requests arrive at the same time when the node has just been started.