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
For a simple port scanning script I queued executions of port scans expecting each of the scans to either resolve (port opened) or reject (port closed).
Another problem I found is that the queue was not really executing concurrently. After analyzing the reason for this I found the problem on the dequeue() method, which is broken in multiple ways:
Promise.all will reject when the first promise rejects! This has two bad effects:
This leads to finalize only being called once even if multiple promises should have been dequeued, leading the currentlyHandled counter to stay one below max, not allowing concurrent execution anymore but just continue with serial execution
No "reject", "resolve" events will be emitted for the executed tasks, that come after the resolve.
I will submit a pull request for a fix.
The text was updated successfully, but these errors were encountered:
domoran
pushed a commit
to domoran/queue-promise
that referenced
this issue
Nov 10, 2019
For a simple port scanning script I queued executions of port scans expecting each of the scans to either resolve (port opened) or reject (port closed).
Another problem I found is that the queue was not really executing concurrently. After analyzing the reason for this I found the problem on the dequeue() method, which is broken in multiple ways:
return Promise.all(promises) .then(values => { for (let output of values) this.emit("resolve", output); return values;# }) .catch(error => { this.emit("reject", error); return error; }) .then(output => { this.finalize(); return output; });
Promise.all will reject when the first promise rejects! This has two bad effects:
This leads to finalize only being called once even if multiple promises should have been dequeued, leading the currentlyHandled counter to stay one below max, not allowing concurrent execution anymore but just continue with serial execution
No "reject", "resolve" events will be emitted for the executed tasks, that come after the resolve.
I will submit a pull request for a fix.
The text was updated successfully, but these errors were encountered: