Gradle 4.6 clean build hangs, all threads WAITING

I would be really grateful is someone can help me figure out

a) is this a Gradle bug?
b) if not, what next steps of troubleshooting would you suggest…?

On Gradle 4.6 I am seeing an issue where my ‘clean build’ will hang indefinitely (but only sometimes).

I originally saw this issue in 4.0.2.

I upgraded to 4.6 after reading Composite build hangs after upgrade to Gradle 4.0 but I still experience the same issue.

This makes me think it will be related to my project, tests or build scripts. (I was on 4.0.2 a long time without seeing this issue).

Looking at the thread dumps, all build operations threads are WAITING.

I have attached:

Setup:

Gradle version: 4.6

gradle.properties:

org.gradle.jvmargs=-server -Xms768m -Xmx6192m -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+AggressiveOpts
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.configureondemand=true