NC29: Cron warning memory increase

Why is in cron.php a hard coded warning for memory increase?

			if ($memoryAfter - $memoryBefore > 10_000_000) {
				$logger->warning('Used memory grew by more than 10 MB when executing job ' . $jobDetails . ': ' . Util::humanFileSize($memoryAfter). ' (before: ' . Util::humanFileSize($memoryBefore) . ')', ['app' => 'cron']);
			}

KR

Because monitoring excessive memory consumption by background jobs is new in v29.

Though perhaps the 10M one should be at info level. Need some more field experience with it I suppose.

Why do you ask? Are you getting a bunch? If so, from any job in particular?

Because I often have increases over 10MB, and always an entry in the log and a brown bubble/hint in the adminitravite overview. The value is dropping an increasing depending an the changes. The value should be configurable.

I have the same issues. Can I increase the limit in the file myself or do I have to wait for a solution again?

What jobs are being reported? It should say in each log entry.

{“reqId”:“e6KjRIvnFfalNwghp2VA”,“level”:2,“time”:“2024-04-25T13:20:18+00:00”,“remoteAddr”:“”,“user”:“–”,“app”:“cron”,“method”:“”,“url”:“–”,“message”:“Used memory grew by more than 10 MB when executing job OCA\Recognize\BackgroundJobs\ClassifyImagenetJob (id: 265, arguments: {"storageId":1,"rootId":1}): 49.2 MB (before: 39.2 MB)”,“userAgent”:“–”,“version”:“29.0.0.19”,“data”:{“app”:“cron”},“id”:“662a8f810871c”}

and

[cron] Warnung: Used memory grew by more than 10 MB when executing job OCA\Recognize\BackgroundJobs\ClassifyImagenetJob (id: 265, arguments: {“storageId”:1,“rootId”:1}): 49.2 MB (before: 39.2 MB)
von ? von – um 25.04.2024, 15:20:18

I changed the hard coded value to 30_000_000 in cron.php

181			if ($memoryAfter - $memoryBefore > 30_000_000) {

Mostly I have the warning when someone (my wife) came back home and the automatic upload of the pictures has started (Android Client).

KR

3 Likes

this solved my problem. thank you

My log is being flooded with “Cron job used more than 300 MB of ram after executing job” whe running Memories->IndexJob, Richdocuments->Backgroundjobs, UpdateNotification->UpdateAvailableNotifications, WorkflowEngine->Rotate, BackgroundJobs->CleanupLoginFlowV2. All say that it used about 797MB

Same thing is happening to me. Disk usage is increasing a lot too, about 15GB.

Output Buffering must be turned off in .htaccess or .user.ini or php.ini, or PHP will return memory-related errors:

  • output_buffering = 0

Ref: Uploading big files > 512MB — Nextcloud latest Administration Manual latest documentation

Thanks for pointing this out. I just edited my php.ini. :+1:

1 Like

I have similar warnings.

Jobs including:
Mail\BackgroundJob\SyncJob
Files_Versions\BackgroundJob\ExpireVersions
TextToImage\RemoveOldTasksBackgroundJob
Log\Rotate
NextcloudAnnouncements\Cron\Crawler
PHP:

Version: 8.2.18

Memory limit: 3 GB

Max execution time: 3600

Upload max size: 10 GB

OPcache Revalidate Frequency: 60

Adjustment to levels logged at is pending (assuming others agree w/ it): fix(cron): Log excess memory usage at debug and info levels by joshtrichards · Pull Request #45530 · nextcloud/server · GitHub

do you know where the php.ini file is stored on the AIO nextcloud for docker aqs i as well get alot of these memory errors

Used memory grew by more than 10 MB when executing job OCA\Files_Trashbin\BackgroundJob\ExpireTrash (id: 25, arguments: null): 37.9 MB (before: 27.4 MB)

There are no PHP config changes that will change this message. Please do not change any in an attempt to do so.

The memory threshold for this warning has changed in the next upcoming maintenance release. In the initial implementation the bar was too low.

If you need the fix sooner, you can apply the PR as a patch in the manner described in the Admin Manual.

https://docs.nextcloud.com/server/latest/admin_manual/issues/applying_patch.html

1 Like

Thank you i will wait

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.