-
-
Notifications
You must be signed in to change notification settings - Fork 968
Closed
Description
If running 1000 reactor grails.async.Promises.task in succession , they will not all complete and hang forever..
Steps to Reproduce
- Create fresh grails 3.1.12 app
- Run the following script somewhere in the app (Bootstrap was a good place to test or a controller)
def total = 0
def tasks = []
for(int i=0; i < 1000 ; i++) {
tasks << Promises.task {
def b = 1
return b
}.onComplete { res ->
println "On Complete ${i}"
total++
}
}
Promises.waitAll(tasks)
println "Result ${total}"
This will hang forever... total will never outright = 1000 because of concurrent write on same memory buffer so thats expected.
- Try again by changing promiseFactory back to legacy gpars:
Promises.promiseFactory = new GparsPromiseFactory()
Promises will complete successfully
Expected Behaviour
All instructed promises should complete successfully and return a promise result appropriately
Actual Behaviour
Promise tasks are lost and sometimes not even executed
Environment Information
- Operating System: Mac OS X
- Grails Version: 3.1.12 (all the way back to at least 3.1.6)
- JDK Version: 8