Skip to content

[rc-1.6.0] Settings: a failed read no longer warns, and the supervisor reconnects to log - #1996

Merged
mastacontrola merged 2 commits into
rc-1.6.0from
fix/settings-read-after-disconnect-rc
Oct 28, 2026
Merged

mastacontrola merged 2 commits into
rc-1.6.0from
fix/settings-read-after-disconnect-rc

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Port of #1995 to rc-1.6.0. Fixes #1994 for the next RC.

rc-1.6.0 carries the #1930 port, so it has both routes to the warning: the failed-read iteration in getSetting() / _loadAllSettings(), and the supervisor's settings read on a closed link. The cherry-pick applied clean.

Verification

  • tests/settings-read-failure.test.php and tests/service-fork-fresh-db-link.test.php pass on this branch.
  • Both phpstan passes clean.

🤖 Generated with Claude Code

mastacontrola and others added 2 commits October 28, 2026 08:20
…s to log

PDODB::get() answers false when a read fails. getSetting() and
_loadAllSettings() cast that to an array and iterated it; (array) false is
[false], so each failed read wrote "Trying to access array offset on false"
at FOGBase.php:3747 and :3752. A failed bulk load also emptied the cache in
refreshSettingsCache() and could persist an empty cache file. Both loaders
now treat a non-array result as a failure: a stale entry keeps its value and
is retried next call, and a failed bulk load replaces nothing.

The daemon supervisor is where the failures came from. On RC18 it shares a
socket with its child, so its reads fail while the child starts or stops.
Since #1930 it closes that socket before each fork, but its next log line
can still read a setting -- the log gate, once the cache entry is past its
TTL. The #1930 commit said the supervisor makes no queries after the fork;
that was wrong. Service_Log_message() now reopens the link first, the same
call the child makes. Service_persist() still closes it before every fork,
so no child inherits it.

tests/settings-read-failure.test.php runs the real FOGBase on a DB stub that
fails every read; on the unfixed tree it reports the reporter's exact
warnings. A shadow-tree run of the real Service_Log_message() after
disconnect(): unfixed, 3 warnings and the link left closed; fixed, none and
the link open.

Fixes #1994

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8e0b3c2)
global-class-prefix requires it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 94ed358)
@mastacontrola
mastacontrola merged commit 2196855 into rc-1.6.0 Oct 28, 2026
10 checks passed
@mastacontrola
mastacontrola deleted the fix/settings-read-after-disconnect-rc branch October 28, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant