[SERVER-2296] $OR queries with large numbers of attributes values cause memory allocation error and server shutdown Created: 28/Dec/10  Updated: 30/Mar/12  Resolved: 28/Dec/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.6.5
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Thomas DeMille Assignee: Aaron Staple
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows Server 2008 64


Operating System: Windows
Participants:

 Description   

Running an $OR query with a large number of attributes queried, like the one below, cause a c++ error ' Uncaught std::exception: bad allocation, terminating'. I have seen this error with as few as 15 and as many as 300 queried $OR attributes. This is using the 10GEN c# driver to create the query. Below is the output from the mongod log. In some cases the last thing logged on the connection will be 'running multiple plans', but not in all cases. In the case below this is the exact output from the server with nothing filtered.

Mon Dec 27 19:14:52 [conn1] run command BtSearchCache.$cmd { count: "Board_12", query: { g:

{ $lte: 200000 }

, RN:

{ $ne: 1 }

, CL:

{ $ne: 1 }

, $or: [

{ c: "2362" }

,

{ c: "2343" }

,

{ c: "2333" }

,

{ c: "2388" }

,

{ c: "2302" }

,

{ c: "2353" }

,

{ c: "1561" }

,

{ c: "2312" }

,

{ c: "2280" }

,

{ c: "1438" }

,

{ c: "2255" }

,

{ c: "2254" }

,

{ c: "1435" }

,

{ c: "1407" }

,

{ c: "2262" }

,

{ c: "1356" }

,

{ c: "2326" }

,

{ c: "2278" }

,

{ c: "2275" }

,

{ c: "2351" }

,

{ c: "2417" }

,

{ c: "1484" }

,

{ c: "2266" }

,

{ c: "41397" }

,

{ c: "2299" }

,

{ c: "2334" }

,

{ c: "1276" }

,

{ c: "41396" }

,

{ c: "2354" }

,

{ c: "2235" }

,

{ c: "2233" }

,

{ c: "1363" }

,

{ c: "2425" }

,

{ c: "2376" }

,

{ c: "2366" }

,

{ c: "2258" }

,

{ c: "1453" }

,

{ c: "1475" }

,

{ c: "2358" }

,

{ c: "1434" }

,

{ c: "1476" }

,

{ c: "2345" }

,

{ c: "1402" }

,

{ c: "2405" }

,

{ c: "2315" }

,

{ c: "2323" }

,

{ c: "2399" }

,

{ c: "2301" }

,

{ c: "1334" }

,

{ c: "1416" }

,

{ c: "2328" }

,

{ c: "2270" }

,

{ c: "2352" }

] } }
Mon Dec 27 19:15:08 [conn2] Uncaught std::exception: bad allocation, terminating
Mon Dec 27 19:15:08 dbexit:
Mon Dec 27 19:15:08 [conn2] shutdown: going to close listening sockets...
Mon Dec 27 19:15:08 [conn2] closing listening socket: 224
Mon Dec 27 19:15:08 [conn2] closing listening socket: 228
Mon Dec 27 19:15:08 [conn2] closing listening socket: 240
Mon Dec 27 19:15:08 [conn2] closing listening socket: 244
Mon Dec 27 19:15:08 [conn2] shutdown: going to flush oplog...
Mon Dec 27 19:15:08 [conn2] shutdown: going to close sockets...
Mon Dec 27 19:15:08 [conn2] shutdown: waiting for fs preallocator...
Mon Dec 27 19:15:08 [conn2] shutdown: closing all files...
Mon Dec 27 19:15:08 [conn4] MessagingPort recv() errno:10053 An established connection was aborted by the software in your host machine. 192.168.100.187:62638
Mon Dec 27 19:15:08 [conn4] SocketException: 9001 socket exception
Mon Dec 27 19:15:08 [conn4] end connection 192.168.100.187:62638
Mon Dec 27 19:15:08 [conn3] MessagingPort recv() errno:10053 An established connection was aborted by the software in your host machine. 192.168.100.187:62627
Mon Dec 27 19:15:08 [conn3] SocketException: 9001 socket exception
Mon Dec 27 19:15:08 [conn3] end connection 192.168.100.187:62627
Mon Dec 27 19:15:08 closeAllFiles() finished



 Comments   
Comment by Aaron Staple [ 28/Dec/10 ]

I think this is SERVER-2298, fixed in 1.7.

It looks like your query can be written using the $in operator to avoid this issue in 1.6.

Generated at Thu Feb 08 02:59:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.