-
Notifications
You must be signed in to change notification settings - Fork 11
Expand 'mask' bitmask space from unsigned short to uint32_t (16=>32 bits) #82
Conversation
assert.end(); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The testcase below works by
- Adding 10k features with the same x/y coordinates to a gridcache entry
- Layering two features on top of causing each to inherit the 10k features into their respective cover lists
Normally as each of those features incorporate parent features into their contexts, they would do a mask check making sure that they don't add two features that both correspond to the same term in a query. When a mask overflow occurs in master it results in an empty mask which can always be combined with any other feature. This leads to the child features inheriting all 10k parent features and leads to OOM.
Whoa, nice find! |
Nice work tracking this one down @yhahn. Your finding has prompted me to think hard about how we can avoid overflows in the future. I'll drop a few notes here now. Removing the - subq.mask = static_cast<unsigned short>(jsStack->Get(Nan::New("mask").ToLocalChecked())->IntegerValue());
+ subq.mask = jsStack->Get(Nan::New("mask").ToLocalChecked())->IntegerValue(); Reveals a warning which helps show the potential for a problem:
We have several of these warnings currently happening in the code in other places - they look minor but I think we should resolve them so that if new warnings come up they are obvious. Per chat I also am keen to revisit our use of I've found
|
I've sketched out a next action at #94 to ensure we are more protected from bugs like this in the future.
it is because this is not a supported feature to detect these types of problems yet in the sanitizers. So we are dependent currently on |
Problem
carmen
currently supports a maximum of 20 query tokens (https://github.com/mapbox/carmen/blob/master/lib/constants.js#L7)carmen-cache
represents the bit mask for subqueries usingunsigned short
which has 16 bits -- so it can at most represent a 16-token querycarmen-cache/src/binding.cpp
Line 1340 in e43612a
This PR
unsigned short
touint32_t
for all subquery bitmasks incarmen-cache
cc @mapbox/geocoding-gang @springmeyer