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