nextcloud / nextcloud/calendar

Exporting calendar triggers PHP error

Open
#7,440 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop bug performance 🚀 technical debt
Dominant language
JavaScript
Stars
1.2k
Forks
332
Avg merge
16h 13m
Merged PRs (30d)
137

Description

Steps to reproduce
  1. Export a specific calendar from the NC calendar app
  2. Export fails, browser shows "This site can't be reached", ERR_INVALID_RESPONSE
Expected behavior

Calendar should be exported as ICS. It works for the other calendars.

Actual behavior

Export fails, browser shows "This site can't be reached", ERR_INVALID_RESPONSE
NC log shows fatal PHP error, too much memory used.

Calendar app version

5.5.4

CalDAV-clients used

No response

Browser

Chrome 138.0.7204.183

Client operating system

Ubuntu

Server operating system

TrueNAS 25.04.2.4

Web server

Apache

Database engine version

PostgreSQL

PHP engine version

Other

Nextcloud version

31.0.8 AIO

Updated from an older installed version or fresh install

Updated from an older version

List of activated apps

Nextcloud configuration

Web server error log

Log file
{"reqId":"ndTuJr5ckqHVJc4OZvNX","level":3,"time":"2025-09-17T17:07:59+00:00","remoteAddr":"192.168.0.45","user":"--","app":"no app in context","method":"GET","url":"/apps/logreader/api/poll?lastReqId=h9IWiSSVh1S84gGAce2q","message":"Slow session operation session_start detected","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36","version":"31.0.8.1","data":{"parameters":"[{\"cookie_samesite\":\"Lax\"}]","timeSpent":"35.699723958969116"},"id":"68caeb3330b24"}
{"reqId":"v6HvUr6mhvzwsnVtmBXN","level":2,"time":"2025-09-17T17:07:52+00:00","remoteAddr":"192.168.0.45","user":"--","app":"no app in context","method":"PROPFIND","url":"/remote.php/dav/calendars/airflow/","message":"Slow session operation session_start detected","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36","version":"31.0.8.1","data":{"parameters":"[{\"cookie_samesite\":\"Lax\"}]","timeSpent":"22.60184407234192"},"id":"68caeb3e2f237"}
{"reqId":"h9IWiSSVh1S84gGAce2q","level":4,"time":"2025-09-17T16:54:15+00:00","remoteAddr":"192.168.0.45","user":"airflow","app":"core","method":"GET","url":"/remote.php/dav/calendars/airflow/outlook-1/?export","message":"Request used more than 300 MB of RAM: 479.7 MB","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36","version":"31.0.8.1","data":{"app":"core"},"id":"68caeb3e2f243"}
{"reqId":"h9IWiSSVh1S84gGAce2q","level":3,"time":"2025-09-17T16:54:15+00:00","remoteAddr":"192.168.0.45","user":"airflow","app":"PHP","method":"GET","url":"/remote.php/dav/calendars/airflow/outlook-1/?export","message":"Allowed memory size of 536870912 bytes exhausted (tried to allocate 28686776 bytes) at /var/www/html/3rdparty/sabre/http/lib/Sapi.php#80","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36","version":"31.0.8.1","data":{"app":"PHP"},"id":"68caeb3e2f24b"}
Browser log

Additional info

The issue came up during my troubleshooting attempts to fix performance issues with the calendar app. I use NC calendar app with several different calendars (4). One of these 4 calendars is loading quite slowly (takes about 5-10 seconds to load). If you actually using the calendar, these 5-10 seconds are triggered at each small step that you might take, for example switching between one week and the next week always triggers the delay, creating an appointment triggers the delay, etc.

If I hide this one calendar, everything is very fast and responsive.

The specific calendar is my work/office calendar, which is synced with caldavsync between my PC from work/office (which uses Outlook) and my NC instance (which holds all my appointments, private and work).

This work calendar holds all my work appointment from years back. Nothing fancy or extreme, to my mind.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GET /remote.php/dav/calendars/airflow/outlook-1/?export request and the memory-exhaustion entry pointing to /var/www/html/3rdparty/sabre/http/lib/Sapi.php#80. No source entry point or test is named in the report, so trace the export path before defining coverage. Done means exporting this large calendar completes without exhausting PHP memory or returning ERR_INVALID_RESPONSE.

Written by the indexing model from the issue text.

Assessment

Tech stack
apache, php, postgresql
Domain
api, backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.