You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is in contrast to if you just create a slightly longer deadline like const deadline = Date.now() + 1000;. The callback will be executed with the deadline exceeded error.
I've used the debugger to trace why this is happening.
At the deadline-filter.js (compiled from TS), you have:
The timeout ends up being negative, because the deadline is too close to now.
Following through with the callStream.cancelWithStatus, it eventually leads to the outputStatus method on Http2CallStream.
In the process.nextTick call, the _a or this.listener ends up being null. When it is null, it never is able to execute the _a.onReceiveStatus(filteredStatus).
constfilteredStatus=this.filterStack.receiveTrailers(this.finalStatus);/* We delay the actual action of bubbling up the status to insulate the * cleanup code in this class from any errors that may be thrown in the * upper layers as a result of bubbling up the status. In particular, * if the status is not OK, the "error" event may be emitted * synchronously at the top level, which will result in a thrown error if * the user does not handle that event. */process.nextTick(()=>{var_a;(_a=this.listener)===null||_a===void0 ? void0 : _a.onReceiveStatus(filteredStatus);});
Because the _a.onReceiveStatus(filteredStatus) is never called, it never returns the status back to the unary call callback, and thus the callback is never executed.
Reproduction steps
Clone this:
nix-shell # optional (if you have npm, you can just proceed)# terminal 1
npm run polykey -- agent start --password-file=<(echo 'abc') --verbose
# terminal 2
npm run polykey -- agent unlock --verbose
Problem description
If you set the deadline to the current date during a unary call:
This is in contrast to if you just create a slightly longer deadline like
const deadline = Date.now() + 1000;
. The callback will be executed with the deadline exceeded error.I've used the debugger to trace why this is happening.
At the
deadline-filter.js
(compiled from TS), you have:The
timeout
ends up being negative, because the deadline is too close to now.Following through with the
callStream.cancelWithStatus
, it eventually leads to theoutputStatus
method onHttp2CallStream
.In the
process.nextTick
call, the_a
orthis.listener
ends up beingnull
. When it isnull
, it never is able to execute the_a.onReceiveStatus(filteredStatus)
.Because the
_a.onReceiveStatus(filteredStatus)
is never called, it never returns the status back to the unary call callback, and thus the callback is never executed.Reproduction steps
Clone this:
You can see that the the
console.log
here:https://github.com/MatrixAI/js-polykey/blob/grpcdeadlinebug/src/client/GRPCClientClient.ts#L119-L121
And here:
https://github.com/MatrixAI/js-polykey/blob/grpcdeadlinebug/src/grpc/utils/utils.ts#L215-L224
Are not logged out. If you change the deadline here to plus
1000
ms: https://github.com/MatrixAI/js-polykey/blob/grpcdeadlinebug/src/bin/agent/CommandUnlock.ts#L45Then the messages will be outputted and the callback will be executed.
Environment
The text was updated successfully, but these errors were encountered: