Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sergeycherepanov opened this issue Jan 14, 2019 · 8 comments

Comments

@sergeycherepanov
Copy link

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?

@markstory
Copy link
Member

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

@sergeycherepanov
Copy link
Author

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

@jaiminp-nimblechapps
Copy link

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"
}

@sergeycherepanov
Copy link
Author

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

@yingding
Copy link

@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

@HarishKumarGudivada
Copy link

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

@boldhedgehog
Copy link

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

@lvkss2012
Copy link

use index on your sorted field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants