Skip to content

Grails 3.1.x Async Reactor based Tasks Fail sporadically #10247

@davydotcom

Description

@davydotcom

If running 1000 reactor grails.async.Promises.task in succession , they will not all complete and hang forever..

Steps to Reproduce

  1. Create fresh grails 3.1.12 app
  2. 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.

  1. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions