We have code running a Knexjs migration which is wrapped in some code that we use Zonejs for tracing execution. It appears that by the time Zonejs tries to cancel a task, it is already in a notScheduled state.
{"type":"Error",
"message":"eventTask 'Client_PG.addListener:start': can not transition to 'canceling', expecting state 'scheduled' or 'running', was 'notScheduled'.",
"stack_trace":[
"Error: eventTask 'Client_PG.addListener:start': can not transition to 'canceling', expecting state 'scheduled' or 'running', was 'notScheduled'.",
" at ZoneTask._transitionTo (/opt/nodejs/node_modules/zone.js/dist/zone-node.js:532:23)",
" at Zone.cancelTask (/opt/nodejs/node_modules/zone.js/dist/zone-node.js:270:18)",
" at Client_PG.proto.<computed> [as removeListener (/opt/nodejs/node_modules/zone.js/dist/zone-node.js:1959:43)",
" at /opt/nodejs/node_modules/knex/lib/util/make-knex.js:284:19",
" at Array.forEach (<anonymous>)"," at redefineProperties (/opt/nodejs/node_modules/knex/lib/util/make-knex.js:283:29)",
" at Object.withUserParams (/opt/nodejs/node_modules/knex/lib/util/make-knex.js:207:7)",
" at Function.value (/opt/nodejs/node_modules/knex/lib/util/make-knex.js:90:29)",
" at new Migrator (/opt/nodejs/node_modules/knex/lib/migrate/Migrator.js:34:26)",
" at Function.get (/opt/nodejs/node_modules/knex/lib/util/make-knex.js:49:14)"]}
Node: 16.14.0
Knex: 0.21.21
Zone.js: 0.8.29
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
No
Description
We have code running a Knexjs migration which is wrapped in some code that we use Zonejs for tracing execution. It appears that by the time Zonejs tries to cancel a task, it is already in a
notScheduledstate.A similar circumstance was fixed awhile back in the context of
runTask, see angular/zone.js#778It may be a simple fix to add a similar guard in
cancelTaskat https://github.com/angular/angular/blob/master/packages/zone.js/lib/zone.ts#L959Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version)Anything else?
No response