snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
10.88k stars 3.14k forks source link

LDAP sync cronjob PHP error allocated memory exceeded #12018

Open xinput opened 1 year ago

xinput commented 1 year ago

Debug mode

Describe the bug

Hello there,

I created a script which runs on a daily bases as cronjob and syncs LDAP users to our 5 Locations in Snipe IT.

After the cronjob runs a few days, it then turns out to run into a php error 255 because PHP allocated memory is exceeded.

I checked my env and increased LDAP_MEM_LIM to 1024 already. After a few days: same error. I also increased memory limit in php.ini without success.

What seems to be working is to run the php artisan cache;clear php artisan config:cache

commands which then leads to a functioning script again. Any ideas why this issue could appear and how to solve it?

Cheers

Reproduction steps

1.create crojob that runs daily to sync ldap users 2.wait until it runs 2-3 times 3.issue appears

Expected behavior

cronjob should run without issues on a daily basis

Screenshots

No response

Snipe-IT Version

6.0.12

Operating System

Rocky Linux 8

Web Server

nginx

PHP Version

8.0.24

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

Rocky Linux 8 was installed fresh and is only used to serve Snipe IT application. I'm running it on nginx with php-fpm.

Installation was done via git.

xinput commented 1 year ago

Small update on this. It seems that the LDAP_MEM_LIM from .env is not replicated to the LDap_Sync.php console command.

After hard coding 1024M into LDAP_Sync.php the error dissappears.

So I assume it's some kind of Bug.

xinput commented 1 year ago

small push on this issue. my hardcoded changes to the php file will be overwritten with every SNipe IT Upgrade.

snipe commented 1 year ago

Sorry for not answering this sooner. Honestly, I have no idea. If it fixes it, just run those clear scripts right after you use the sync.

xinput commented 1 year ago

No worries. A while ago I implemented the clear scripts into the script and they run on each script execution now. This seems to be a workaround for me. We can close this. :)

kuratlielia commented 6 months ago

Hi, could you maybe share the script?

snipe commented 6 months ago

https://snipe-it.readme.io/docs/common-issues#quick-tip-handy-commands

Snipe-IT Documentation
Common Issues
🚧Problem Installing/Upgrading?We've moved the the most common installation/upgrade issues to their own page. If you're having an issue installing or upgrading Snipe-IT, please check the Installation/Upgrading Issues page before opening a ticket on Github.Quick Tip: Handy Commands👍Many issues can b...