Exception while invoking TaskListener: Exception while invoking TaskListener: null
https://community.alfresco.com/thread/225041-exception-while-invoking-tasklistener-null
Ok, so the problem is quite easy: in 5.9 (and other versions) the transaction management with spring was actually not consistent. In 5.18 (and earlier), we fixed this. Thus, your call for the callback is executed is executed in the same transaction as the others, which means in the next taskQuery call, the value is NOT yet updated as the transaction is still happening and it hasn't been comitted yet. So the behaviour in 5.18 is actually correct and honoring the correct transaction semantics.
https://community.alfresco.com/thread/230928-exception-while-invoking-tasklistener-null
https://community.alfresco.com/thread/224969-error-while-migration-from-activiti-engine-59-to-5180