Skip to content

Commit c0e87d5

Browse files
committed
fix(OpMsg): cap requestIds at 0x7fffffff
Since OpMsg uses buffer write methods, these methods can throw if the buffer attempts to write a number to large for the space. We now cap the requestId at 0x7fffffff and loop back around to 0 Fixes NODE-2067
1 parent 4abd45b commit c0e87d5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/core/connection/msg.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ class Msg {
130130
}
131131

132132
Msg.getRequestId = function() {
133-
return ++_requestId;
133+
_requestId = (_requestId + 1) & 0x7fffffff;
134+
return _requestId;
134135
};
135136

136137
class BinMsg {

0 commit comments

Comments
 (0)