Search code examples
javaangularspringjbosswildfly

Worker tasks spawned multiple times in WildFly


I have an application where my front end is written in Angular and backend in java with spring deployed on WildFly. Front end is communicating backend REST services. There is one specific service(say service-X ) which has a HIVE query which takes around 120 sec to execute. I have put up some logging into app. Now here comes the weird part: When this REST is invoked, following things happen:

  • ajpworker task-1 is spawned and it hits the SQL on HIVE JDBC connection, say at t time and waits.
  • After 30 seconds i.e t+30 ajpworker task-2 is spawned and hits the SQL and waits.
  • After 30 seconds ajpworker task-3 is spawned and do similar things.

After t+90 the timeout occurs and the connection breaks out for ajpworker task-1. Similar for other workers. This part is understandable that the request is getting timeout from Angular and hence the connection is broke.

But unable to understand why multiple worker tasks are spawned after 30 seconds. Is this related to configuration file (similar to worker.properties) present in WildFly.


Solution

  • Finally found the root cause behind this. Multiple ajp threads were spawned because of JBOSS_SocketTimeout parameter set to 30 seconds in my Wildfly configuration file. Changed this to 180 secs(Maximum time that the REST can take to respond) and it works just fine.