perftools / xhgui

Web interface for XHProf profiling data can store data in MongoDB or PDO database
1.65k stars 342 forks source link

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

Open sergeycherepanov opened 5 years ago

sergeycherepanov commented 5 years ago

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 commented 5 years ago

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

sergeycherepanov commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

yingding commented 5 years ago

@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 commented 5 years ago

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

boldhedgehog commented 4 years ago

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

lvkss2012 commented 2 years ago

use index on your sorted field