Cfthread WAITING status

We’re gradually migrating our SaaS from Railo (4.5) to Lucee (currently 5.3.3.62 running on Debian 10 with Java 11 and Tomcat 9).

On the remaining bits which are still running on Railo we have a cfm page that is run (called from a Java service via HTTP) regularly and does some behind-time batch processing. It uses cfthread to run the work on a separate thread and then polls the thread status every 500ms waiting for thread to finish and writes to output to keep the AJP connection between Apache and Tomcat alive (timeout is 5 mins but the batch job can take longer than that).

This all works nicely except that every now and again (say once every day or 2), the cfthread status that we poll is set to “WAITING” which is unexpected because the code run by the thread does not use cfthread itself (docs say “WAITING” means cfthread action=“join”). When we’ve looked at the stack trace of the thread at the time it’s returned “WAITING” we don’t see the same path each time so it’s not one particular thing that appears to cause this.

So the Adobe CFML docs say “WAITING” is the the status of a thread that has itself issued cfthread action=“join”. Is that still the case with Lucee? Is it possible for a thread to have status “WAITING” for any other reason?

We can update our code to handle the “WAITING” status (and also terminate the thread if we find it’s continuously waiting for too long) but just want to check if this is possibly a Railo bug that we won’t need to worry about on Lucee.

Thanks,
Gary.

you could have a look thru jira issues? I’ve labelled all the thread ones

https://luceeserver.atlassian.net/issues/?jql=labels%20%3D%20threads%20ORDER%20BY%20resolution%20ASC%2C%20status%20DESC

Thanks. Sorry - I should have said that I checked for any issues and looked through the docs. Nothing came up which is why I wondered whether WAITING status could be returned for a reason other than the thread doing a join and waiting for child threads to finish.

If I’ve not missed anything obvious then I’m happy to wait until we migrate this job to Lucee and then see if the issue still occurs - but I just wanted to check ahead of time in case it was something already known about.

1 Like

Pull a thread dump of the JVM and see exactly what the thread is doing. One possible difference between Railo and Lucee (I forget exactly when Micha made this change) is that the CFHTTP tag spins off another background thread to run the actual HTTP connection. This is so it can kill it easier if it times out without hanging the main request. The main thread where the CFHTTP call was, waits to join back to the thread making the actual call. It’s likely you’re just seeing that. But again, stop guessing and just pull a thread dump and your questions will be immediately answered :slight_smile:

just install my performance analyzer, it has a thread report

1 Like

Where is your performance analyzer?

@Daemach lucee/admin/server.cfm?action=ext.applications under not-installed → release type

1 Like