Investigate paginator and fix 500 error
[2020-09-23T14:16:00.904Z] | prozorro_sale.auction.api.api | ERROR - Unknown error caught in API - Executor error during find command :: caused by :: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit., full error: {'operationTime': Timestamp(1600870553, 1), 'ok': 0.0, 'errmsg': 'Executor error during find command :: caused by :: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.', 'code': 96, 'codeName': 'OperationFailed', '$clusterTime': {'clusterTime': Timestamp(1600870553, 1), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0}}} | X-Request-ID: 79b187e5-9938-452c-bfde-c4fbb2807c23
Traceback (most recent call last):
File "/auction/prozorro_sale/auction/errors.py", line 74, in request_localized_errors_middleware
return await handler(request)
File "/usr/local/lib/python3.8/site-packages/prozorro_sale/auth/__init__.py", line 74, in context_middleware
return await handler(request)
File "/auction/prozorro_sale/auction/utils.py", line 103, in bidder_to_context
return await handler(request)
File "/usr/local/lib/python3.8/site-packages/prozorro_sale/tools/__init__.py", line 81, in retry_on_concurrency_error_middleware
return await handler(request)
File "/usr/local/lib/python3.8/site-packages/prozorro_sale/tools/__init__.py", line 45, in request_unpack_params
return await handler(request, **request.match_info)
File "/auction/prozorro_sale/auction/api/api.py", line 37, in auction_list
list_auction = await db.read_auction_list(_skip_param, paginator['limit'])
File "/auction/prozorro_sale/auction/db.py", line 94, in read_auction_list
async for obj in cursor.skip(skip * limit).limit(limit):
File "<string>", line 7, in __anext__
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/site-packages/pymongo/cursor.py", line 1124, in _refresh
self.__send_message(q)
File "/usr/local/lib/python3.8/site-packages/pymongo/cursor.py", line 999, in __send_message
response = client._run_operation_with_response(
File "/usr/local/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1368, in _run_operation_with_response
return self._retryable_read(
File "/usr/local/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1471, in _retryable_read
return func(session, server, sock_info, slave_ok)
File "/usr/local/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1360, in _cmd
return server.run_operation_with_response(
File "/usr/local/lib/python3.8/site-packages/pymongo/server.py", line 136, in run_operation_with_response
_check_command_response(
File "/usr/local/lib/python3.8/site-packages/pymongo/helpers.py", line 167, in _check_command_response
raise OperationFailure(msg % errmsg, code, response,
pymongo.errors.OperationFailure: Executor error during find command :: caused by :: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit., full error: {'operationTime': Timestamp(1600870553, 1), 'ok': 0.0, 'errmsg': 'Executor error during find command :: caused by :: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.', 'code': 96, 'codeName': 'OperationFailed', '$clusterTime': {'clusterTime': Timestamp(1600870553, 1), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0}}}
[2020-09-23T14:16:00.904Z] | aiohttp.access | INFO - "178.150.90.134 GET /api/auctions?page=1000 HTTP/1.1 500 374 - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36 0.028490" | X-Request-ID: 79b187e5-9938-452c-bfde-c4fbb2807c23
Edited by Ghost User