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

Status Label asset count exhausts memory with many assets #9680

Closed
2 tasks done
travismiller opened this issue Jun 9, 2021 · 0 comments
Closed
2 tasks done

Status Label asset count exhausts memory with many assets #9680

travismiller opened this issue Jun 9, 2021 · 0 comments

Comments

@travismiller
Copy link
Contributor

Please confirm you have done the following before posting your bug report:

Describe the bug

The api/v1/statuslabels/assets endpoint exhausts memory when there are a “large” number of assets.

To Reproduce
Steps to reproduce the behavior:

  1. Load ~160k assets
  2. Visit the dashboard
  3. See that the statuslabels/assets endpoint returns a 500 error

Expected behavior

The endpoint should not exhaust memory.

Screenshots

image

Here’s a screenshot of the feature that uses this API endpoint (when a fix is applied):

image

Server (please complete the following information):

  • Snipe-IT Version: develop
  • OS: Docker (php:7.4.20-apache)
  • Web Server: Docker (php:7.4.20-apache)
  • PHP Version: 7.4.20
Apache log

app_1       | [Wed Jun 09 16:23:19.996346 2021] [php7:error] [pid 86] [client 192.168.16.1:63222] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 8192 bytes) in /var/www/snipe-it/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 255, referer: http://localhost:3051/
app_1       | [Wed Jun 09 16:23:20.004889 2021] [php7:error] [pid 86] [client 192.168.16.1:63222] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32768 bytes) in /var/www/snipe-it/vendor/symfony/debug/Exception/FatalErrorException.php on line 1, referer: http://localhost:3051/
app_1       | 192.168.16.1 - - [09/Jun/2021:16:23:17 +0000] "GET /api/v1/statuslabels/assets HTTP/1.1" 500 185 "http://localhost:3051/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/201001

Additional context

travismiller added a commit to tulsaschoolsdata/snipe-it that referenced this issue Jun 9, 2021
travismiller added a commit to tulsaschoolsdata/snipe-it that referenced this issue Jun 10, 2021
snipe added a commit that referenced this issue Jun 23, 2021
…asset-count

Fixed #9680: Use Eloquent’s `withCount` method to count Statuslabel assets
@snipe snipe closed this as completed in 4f6b1bb Jun 23, 2021
PetriAsi pushed a commit to PetriAsi/snipe-it that referenced this issue Jul 15, 2021
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

1 participant