{
  "id": "php/session-gc-probability-high",
  "signature": "Warning: session_start(): Session GC failed in /var/www/app/src/Session/SessionManager.php:35",
  "signature_zh": "警告: session_start(): Session GC 失败，位于 /var/www/app/src/Session/SessionManager.php:35",
  "regex": "Warning: session_start\\(\\): Session GC failed in .* on line \\d+",
  "domain": "php",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "PHP's session garbage collection (GC) fails due to permission issues on the session save path, disk full, or a misconfigured GC probability that triggers too frequently.",
  "root_cause_type": "generic",
  "root_cause_zh": "PHP 的会话垃圾回收（GC）失败，原因是会话保存路径的权限问题、磁盘已满或 GC 概率配置不当导致触发过于频繁。",
  "versions": [
    {
      "version": "PHP 7.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Setting session.gc_probability=0 disables GC entirely, which prevents the warning but leads to session file accumulation and potential disk space issues.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Increasing session.gc_divisor to 1000 reduces GC frequency but does not fix underlying permission or disk problems; the warning may still appear sporadically.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Fix permissions on the session save path: run 'sudo chmod 733 /var/lib/php/sessions' and 'sudo chown www-data:www-data /var/lib/php/sessions' (adjust user/group as needed).",
      "success_rate": 0.9,
      "how": "Fix permissions on the session save path: run 'sudo chmod 733 /var/lib/php/sessions' and 'sudo chown www-data:www-data /var/lib/php/sessions' (adjust user/group as needed).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check disk space with 'df -h' and free up space if necessary. If using tmpfs for sessions, ensure enough memory is allocated.",
      "success_rate": 0.85,
      "how": "Check disk space with 'df -h' and free up space if necessary. If using tmpfs for sessions, ensure enough memory is allocated.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Reduce GC probability by setting session.gc_probability=1 and session.gc_divisor=1000 in php.ini to trigger GC once every 1000 requests, reducing load.",
      "success_rate": 0.75,
      "how": "Reduce GC probability by setting session.gc_probability=1 and session.gc_divisor=1000 in php.ini to trigger GC once every 1000 requests, reducing load.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Fix permissions on the session save path: run 'sudo chmod 733 /var/lib/php/sessions' and 'sudo chown www-data:www-data /var/lib/php/sessions' (adjust user/group as needed).",
    "Check disk space with 'df -h' and free up space if necessary. If using tmpfs for sessions, ensure enough memory is allocated.",
    "Reduce GC probability by setting session.gc_probability=1 and session.gc_divisor=1000 in php.ini to trigger GC once every 1000 requests, reducing load."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}