xhgui icon indicating copy to clipboard operation
xhgui copied to clipboard

Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.

Open sergeycherepanov opened this issue 6 years ago • 8 comments

Hi, and thanks for the amazing tool!

But unfortunately I have the issue with large requests.

Executor error during find command :: caused by :: errmsg: "Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit."

The stack trace:

#0 /home/linuxbrew/.linuxbrew/opt/xhgui/vendor/alcaeus/mongo-php-adapter/lib/Mongo/MongoCursor.php(170): Alcaeus\MongoDbAdapter\ExceptionConverter::toLegacy(Object(MongoDB\Driver\Exception\RuntimeException))
#1 /home/linuxbrew/.linuxbrew/opt/xhgui/vendor/alcaeus/mongo-php-adapter/lib/Mongo/MongoCursor.php(467): MongoCursor->doQuery()
#2 /home/linuxbrew/.linuxbrew/opt/xhgui/vendor/alcaeus/mongo-php-adapter/lib/Alcaeus/MongoDbAdapter/AbstractCursor.php(297): MongoCursor->ensureCursor()
#3 /home/linuxbrew/.linuxbrew/opt/xhgui/vendor/alcaeus/mongo-php-adapter/lib/Alcaeus/MongoDbAdapter/AbstractCursor.php(190): Alcaeus\MongoDbAdapter\AbstractCursor->ensureIterator()
#4 /home/linuxbrew/.linuxbrew/opt/xhgui/src/Xhgui/Profiles.php(310): Alcaeus\MongoDbAdapter\AbstractCursor->rewind()
#5 /home/linuxbrew/.linuxbrew/opt/xhgui/src/Xhgui/Profiles.php(105): Xhgui_Profiles->_wrap(Object(MongoCursor))
#6 /home/linuxbrew/.linuxbrew/opt/xhgui/src/Xhgui/Profiles.php(256): Xhgui_Profiles->paginate(Array)
#7 /home/linuxbrew/.linuxbrew/opt/xhgui/src/Xhgui/Controller/Run.php(38): Xhgui_Profiles->getAll(Array)
#8 /home/linuxbrew/.linuxbrew/opt/xhgui/src/routes.php(25): Xhgui_Controller_Run->index()
#9 [internal function]: {closure}()
#10 /home/linuxbrew/.linuxbrew/opt/xhgui/vendor/slim/slim/Slim/Route.php(468): call_user_func_array(Object(Closure), Array)
#11 /home/linuxbrew/.linuxbrew/opt/xhgui/vendor/slim/slim/Slim/Slim.php(1355): Slim\Route->dispatch()
#12 /home/linuxbrew/.linuxbrew/opt/xhgui/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#13 /home/linuxbrew/.linuxbrew/opt/xhgui/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#14 /home/linuxbrew/.linuxbrew/opt/xhgui/vendor/slim/slim/Slim/Middleware/SessionCookie.php(110): Slim\Middleware\MethodOverride->call()
#15 /home/linuxbrew/.linuxbrew/opt/xhgui/src/Xhgui/Middleware/Render.php(11): Slim\Middleware\SessionCookie->call()
#16 /home/linuxbrew/.linuxbrew/opt/xhgui/vendor/slim/slim/Slim/Slim.php(1300): Xhgui_Middleware_Render->call()
#17 /home/linuxbrew/.linuxbrew/opt/xhgui/webroot/index.php(10): Slim\Slim->run()
#18 {main}

Does exists any way to pass through it?

sergeycherepanov avatar Jan 14 '19 11:01 sergeycherepanov

I am not sure. You might need to change your monk configuration or give it more memory.

markstory avatar Jan 14 '19 14:01 markstory

Hi @markstory, yes you are right.

It helped:

> mongo <your-server-and-port>
> use admin
> db.adminCommand({setParameter: 1, internalQueryExecMaxBlockingSortBytes:100302864})

I think will be good to add this case to the README

sergeycherepanov avatar Jan 14 '19 14:01 sergeycherepanov

Hi @sergeycherepanov

Can you please help me solving this issue? which appears when I use the following code

db.adminCommand({setParameter: 1, internalQueryExecMaxBlockingSortBytes:100151432})

This is the error I received

{ "operationTime" : Timestamp(1565752556, 1), "ok" : 0.0, "errmsg" : "not authorized on admin to execute command { setParameter: 1.0, internalQueryExecMaxBlockingSortBytes: 100151432.0, $readPreference: { mode: "secondaryPreferred" }, $db: "admin" }", "code" : 13, "codeName" : "Unauthorized" }

jaiminp-nimblechapps avatar Aug 14 '19 04:08 jaiminp-nimblechapps

Hi @jaimin-nimble From the error text, we can conclude that the problem is in the authorization. You must authorize as admin first.

sergeycherepanov avatar Aug 19 '19 14:08 sergeycherepanov

@jaimin-nimble after added the root role in admin db, i can execute the adminCommand

# grant root role
db.grantRolesToUser('YourAdminUser', [{role: "root", db: "admin"}] )
# examin the roles
show users

You can find the details on the discussion in stackoverflow

yingding avatar Sep 11 '19 15:09 yingding

I faced the same issue, we created the indexes for the columns in mongodb which resolves our issue .

HarishKumarGudivada avatar Nov 04 '19 06:11 HarishKumarGudivada

@HarishKumarGudivada could you please share what indexes on which columns?

boldhedgehog avatar Feb 28 '20 13:02 boldhedgehog

use index on your sorted field

lvkss2012 avatar Oct 25 '22 06:10 lvkss2012