Opened 6 years ago

Last modified 3 years ago

#16773 new defect

dojo/request/node request: timer not handled on cancel()

Reported by: w3dman Owned by: Bryan Forbes
Priority: undecided Milestone: 1.15
Component: IO Version: 1.8.3
Keywords: Cc: Kitson Kelly
Blocked By: Blocking:

Description

When using the dojo/request/node xhr with a timeout specified, and the request is cancelled (before the timer triggers), an uncaught exception can occur, and the node process will not exit until the timer finally triggers.

Script where behaviour is noted:

// node-xhr-test.js
require(["dojo/request/node"], function(xhr) {
  
  var request = xhr("http://dojotoolkit.org", {
    timeout: 30000
  });

  request.then(function(response) {
    console.log("Good!");
  }, function(err) {
    // this is triggered, but the process will hang
    // for the 'timeout' period
    console.log("Cancelled/Rejected: but the timer is still pending");
  });

  request.cancel();
 
});
// dojoConfig.js
dojoConfig = {
  async: true,
  baseUrl: ".",
  packages: [{
    name: "dojo",
    location: "dojo/dojo"
  }]
};
require("./dojo/dojo/dojo.js");

Run with: node dojoConfig.js load=node-xhr-test.js

Node.js (v0.8.15) will print the exception to the console and will not exit until the request timer has been triggered.

Change History (5)

comment:1 Changed 6 years ago by w3dman

Had a conversation with kitsonk about this issue on the #dojo IRC channel. I don't seen to be able to add him to the CC list.

comment:2 Changed 6 years ago by bill

Cc: Kitson Kelly added
Component: GeneralIO
Owner: set to Bryan Forbes

comment:3 Changed 4 years ago by dylan

Milestone: tbd1.11

comment:4 Changed 3 years ago by dylan

Milestone: 1.111.12

Unfortunately need to defer to 1.12 without a PR.

comment:5 Changed 3 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.