How to resolve Internal Server Error

I’m seeing this error:


If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.

### Technical details

* Remote Address: 73.223.180.66
* Request ID: YdNLab1qa2l54sUPmejuMgACQzQ 

After much digging I found what I think is the relevant log file, and the following are the two lines from it for the error shown above. I’m on shared hosting and can’t change the settings for MySQL to increase the amount of memory available to it. So how do I resolve this? Is there a way to remove the offending code or app?
Note, I had to edit the lines below as the SQL statement is huge.

{"reqId":"YdNLab1qa2l54sUPmejuMgACQzQ","level":3,"time":"2022-01-03T19:15:54+00:00","remoteAddr":"73.223.180.66","user":"chris","app":"index","method":"GET","url":"/index.php","message":"An exception occurred while executing a query: SQLSTATE[HY001]: Memory allocation error: 1038 Out of sort memory, consider increasing server sort buffer size","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36","version":"22.2.3.0","exception":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[HY001]: Memory allocation error: 1038 Out of sort memory, consider increasing server sort buffer size","Code":1038,"Trace":[{"file":"/home2/bunyip/my.ibunyip.com/3rdparty/doctrine/dbal/src/Connection.php","line":1780,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},{"__class__":"Doctrine\\DBAL\\Query"}]},{"file":"/home2/bunyip/my.ibunyip.com/3rdparty/doctrine/dbal/src/Connection.php","line":1719,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},{"__class__":"Doctrine\\DBAL\\Query"}]},{"file":"/home2/bunyip/my.ibunyip.com/3rdparty/doctrine/dbal/src/Connection.php","line":1067,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},"SELECT ...",{"dcValue1":7,"dcValue2":9,"dcValue3":"4SWcgsnJHirhsuJCzdnEp5IvNeNq32H","dcValue4":1},{"dcValue1":1,"dcValue2":1,"dcValue3":2,"dcValue4":2}]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/DB/QueryBuilder/QueryBuilder.php","line":287,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/vendor/artificial-owl/my-small-php-tools/lib/Db/Nextcloud/nc22/NC22ExtendedQueryBuilder.php","line":1340,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/vendor/artificial-owl/my-small-php-tools/lib/Db/Nextcloud/nc22/NC22ExtendedQueryBuilder.php","line":1276,"function":"getRows","class":"ArtificialOwl\\MySmallPhpTools\\Db\\Nextcloud\\nc22\\NC22ExtendedQueryBuilder","type":"->","args":[[{"__class__":"OCA\\Circles\\Db\\CoreQueryBuilder"},"parseSimpleSelectSql"],"OCA\\Circles\\Model\\ShareWrapper",[]]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/lib/Db/ShareWrapperRequestBuilder.php","line":123,"function":"asItems","class":"ArtificialOwl\\MySmallPhpTools\\Db\\Nextcloud\\nc22\\NC22ExtendedQueryBuilder","type":"->","args":["OCA\\Circles\\Model\\ShareWrapper"]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/lib/Db/ShareWrapperRequest.php","line":339,"function":"getItemsFromRequest","class":"OCA\\Circles\\Db\\ShareWrapperRequestBuilder","type":"->","args":[{"__class__":"OCA\\Circles\\Db\\CoreQueryBuilder"}]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/lib/Service/ShareWrapperService.php","line":180,"function":"getSharedWith","class":"OCA\\Circles\\Db\\ShareWrapperRequest","type":"->","args":[{"__class__":"OCA\\Circles\\Model\\FederatedUser"},0,{"__class__":"OCA\\Circles\\Model\\Probes\\CircleProbe"}]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/lib/ShareByCircleProvider.php","line":557,"function":"getSharedWith","class":"OCA\\Circles\\Service\\ShareWrapperService","type":"->","args":[{"__class__":"OCA\\Circles\\Model\\FederatedUser"},0,{"__class__":"OCA\\Circles\\Model\\Probes\\CircleProbe"}]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Share20/Manager.php","line":1360,"function":"getSharedWith","class":"OCA\\Circles\\ShareByCircleProvider","type":"->","args":["chris",7,null,-1,0]},{"file":"/home2/bunyip/my.ibunyip.com/apps/files_sharing/lib/MountProvider.php","line":79,"function":"getSharedWith","class":"OC\\Share20\\Manager","type":"->","args":["chris",7,null,-1]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/Config/MountProviderCollection.php","line":118,"function":"getMountsForUser","class":"OCA\\Files_Sharing\\MountProvider","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"OC\\Files\\Storage\\StorageFactory"}]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/Filesystem.php","line":429,"function":"addMountForUser","class":"OC\\Files\\Config\\MountProviderCollection","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"OC\\Files\\Mount\\Manager"}]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/Filesystem.php","line":354,"function":"initMountPoints","class":"OC\\Files\\Filesystem","type":"::","args":["chris"]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/legacy/OC_Util.php","line":325,"function":"init","class":"OC\\Files\\Filesystem","type":"::","args":["chris","/chris/files"]},{"file":"/home2/bunyip/my.ibunyip.com/lib/base.php","line":1029,"function":"setupFS","class":"OC_Util","type":"::","args":[]},{"file":"/home2/bunyip/my.ibunyip.com/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/home2/bunyip/my.ibunyip.com/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":92}},"CustomMessage":"--"}}
{"reqId":"YdNLa71qa2l54sUPmejuPQACTzQ","level":3,"time":"2022-01-03T19:15:55+00:00","remoteAddr":"73.223.180.66","user":"chris","app":"index","method":"GET","url":"/index.php/js/core/merged-template-prepend.js?v=15135567-0","message":"An exception occurred while executing a query: SQLSTATE[HY001]: Memory allocation error: 1038 Out of sort memory, consider increasing server sort buffer size","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36","version":"22.2.3.0","exception":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[HY001]: Memory allocation error: 1038 Out of sort memory, consider increasing server sort buffer size","Code":1038,"Trace":[{"file":"/home2/bunyip/my.ibunyip.com/3rdparty/doctrine/dbal/src/Connection.php","line":1780,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},{"__class__":"Doctrine\\DBAL\\Query"}]},{"file":"/home2/bunyip/my.ibunyip.com/3rdparty/doctrine/dbal/src/Connection.php","line":1719,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},{"__class__":"Doctrine\\DBAL\\Query"}]},{"file":"/home2/bunyip/my.ibunyip.com/3rdparty/doctrine/dbal/src/Connection.php","line":1067,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},"SELECT ...",{"dcValue1":7,"dcValue2":9,"dcValue3":"4SWcgsnJHirhsuJCzdnEp5IvNeNq32H","dcValue4":1},{"dcValue1":1,"dcValue2":1,"dcValue3":2,"dcValue4":2}]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/DB/QueryBuilder/QueryBuilder.php","line":287,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->","args":[]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/vendor/artificial-owl/my-small-php-tools/lib/Db/Nextcloud/nc22/NC22ExtendedQueryBuilder.php","line":1340,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/vendor/artificial-owl/my-small-php-tools/lib/Db/Nextcloud/nc22/NC22ExtendedQueryBuilder.php","line":1276,"function":"getRows","class":"ArtificialOwl\\MySmallPhpTools\\Db\\Nextcloud\\nc22\\NC22ExtendedQueryBuilder","type":"->","args":[[{"__class__":"OCA\\Circles\\Db\\CoreQueryBuilder"},"parseSimpleSelectSql"],"OCA\\Circles\\Model\\ShareWrapper",[]]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/lib/Db/ShareWrapperRequestBuilder.php","line":123,"function":"asItems","class":"ArtificialOwl\\MySmallPhpTools\\Db\\Nextcloud\\nc22\\NC22ExtendedQueryBuilder","type":"->","args":["OCA\\Circles\\Model\\ShareWrapper"]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/lib/Db/ShareWrapperRequest.php","line":339,"function":"getItemsFromRequest","class":"OCA\\Circles\\Db\\ShareWrapperRequestBuilder","type":"->","args":[{"__class__":"OCA\\Circles\\Db\\CoreQueryBuilder"}]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/lib/Service/ShareWrapperService.php","line":180,"function":"getSharedWith","class":"OCA\\Circles\\Db\\ShareWrapperRequest","type":"->","args":[{"__class__":"OCA\\Circles\\Model\\FederatedUser"},0,{"__class__":"OCA\\Circles\\Model\\Probes\\CircleProbe"}]},{"file":"/home2/bunyip/my.ibunyip.com/apps/circles/lib/ShareByCircleProvider.php","line":557,"function":"getSharedWith","class":"OCA\\Circles\\Service\\ShareWrapperService","type":"->","args":[{"__class__":"OCA\\Circles\\Model\\FederatedUser"},0,{"__class__":"OCA\\Circles\\Model\\Probes\\CircleProbe"}]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Share20/Manager.php","line":1360,"function":"getSharedWith","class":"OCA\\Circles\\ShareByCircleProvider","type":"->","args":["chris",7,null,-1,0]},{"file":"/home2/bunyip/my.ibunyip.com/apps/files_sharing/lib/MountProvider.php","line":79,"function":"getSharedWith","class":"OC\\Share20\\Manager","type":"->","args":["chris",7,null,-1]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/Config/MountProviderCollection.php","line":118,"function":"getMountsForUser","class":"OCA\\Files_Sharing\\MountProvider","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"OC\\Files\\Storage\\StorageFactory"}]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/Filesystem.php","line":429,"function":"addMountForUser","class":"OC\\Files\\Config\\MountProviderCollection","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"OC\\Files\\Mount\\Manager"}]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/Filesystem.php","line":354,"function":"initMountPoints","class":"OC\\Files\\Filesystem","type":"::","args":["chris"]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/legacy/OC_Util.php","line":325,"function":"init","class":"OC\\Files\\Filesystem","type":"::","args":["chris","/chris/files"]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/Mount/Manager.php","line":91,"function":"setupFS","class":"OC_Util","type":"::","args":[]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/View.php","line":1385,"function":"find","class":"OC\\Files\\Mount\\Manager","type":"->","args":["/appdata_oczxhjb147f8/js/core"]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/Node/Root.php","line":200,"function":"getFileInfo","class":"OC\\Files\\View","type":"->","args":["/appdata_oczxhjb147f8/js/core"]},{"function":"get","class":"OC\\Files\\Node\\Root","type":"->","args":["/appdata_oczxhjb147f8/js/core"]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/Node/LazyFolder.php","line":65,"function":"call_user_func_array","args":[[{"__class__":"OC\\Files\\Node\\Root"},"get"],["appdata_oczxhjb147f8/js/core"]]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/Node/LazyFolder.php","line":142,"function":"__call","class":"OC\\Files\\Node\\LazyFolder","type":"->","args":["get",["appdata_oczxhjb147f8/js/core"]]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Files/AppData/AppData.php","line":141,"function":"get","class":"OC\\Files\\Node\\LazyFolder","type":"->","args":["appdata_oczxhjb147f8/js/core"]},{"file":"/home2/bunyip/my.ibunyip.com/core/Controller/JsController.php","line":72,"function":"getFolder","class":"OC\\Files\\AppData\\AppData","type":"->","args":["core"]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"getJs","class":"OC\\Core\\Controller\\JsController","type":"->","args":["merged-template-prepend.js","core"]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\JsController"},"getJs"]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\JsController"},"getJs"]},{"file":"/home2/bunyip/my.ibunyip.com/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\JsController","getJs",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"appName":"core","fileName":"merged-template-prepend.js","_route":"core.Js.getJs"}]},{"file":"/home2/bunyip/my.ibunyip.com/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/js/core/merged-template-prepend.js"]},{"file":"/home2/bunyip/my.ibunyip.com/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/home2/bunyip/my.ibunyip.com/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":92}},"CustomMessage":"--"}}```