Skip to content

Uw general improvements - #41

Merged
uwiger merged 17 commits into
masterfrom
uw-general-improvements
Jul 30, 2026
Merged

Uw general improvements#41
uwiger merged 17 commits into
masterfrom
uw-general-improvements

Conversation

@uwiger

@uwiger uwiger commented Apr 6, 2020

Copy link
Copy Markdown
Owner

This PR tries to address both issues #37 and #30.

  • Refactoring to ease tracing
  • The locks_server now keeps a central version counter for strictly increasing versions
  • A sliding-window message log, kept in the process dictionary, is used in locks_leader, to facilitate debugging should the election process hang.
  • An 'election vector' is used in locks_leader to better keep up with the status of the locking process, and leader_uncertain is triggered anytime the vectors don't match.

uwiger added 2 commits April 5, 2020 18:19
- refactor support code in agent and server to separate lib mods
  for cleaner tracing
- locks_server sends only one notification per involved agent
- locks_server keeps a global vsn counter to ensure strictly increasing
  versions
- locks_leader maintains an election vector based on lock info
- signal leader_uncertain or ensure_sync more often, esp. if the
  vector info indicates inconsistency.
- moved example code to fit better with rebar3
- remove rebar2-specific compilation in locks_leader_SUITE
@uwiger

uwiger commented Apr 7, 2020

Copy link
Copy Markdown
Owner Author

Note: some issues identified. Still debugging.

Serialize become_leader_ with an async all_alive sync lock and abort_on_deadlock
so competing leaders abort instead of deadlocking on state merge. Harden CT
netsplit setup for peer/OTP 25+ (prevent_overlapping_partitions, allow/1, mesh).
Document findings and next steps in LOCKS_LEADER_IDEAS.md.

Structured netsplit tests pass; random_netsplits still fails under extreme churn.
Replace gen_server+safe_loop with gen_statem states candidate/following/
syncing/leader. Add locks_pg society discovery, async sync-lock merge,
postpone for early leader_calls, and netsplit-aware transitions. Structured
CT suite is green; random_netsplits remains quarantined. Document design in
LOCKS_LEADER_IDEAS.md.
Require same-pid leader consensus after each start_incremental join,
and add a scripted late_join case (stabilize 3, add 4th, state catch-up).
Also calibrate random_netsplits (100 ops, 1s rejoin settle) for local runs.
Drop the intermediate 1000-event ETS window (silent truncation on long
runs) in favour of a single-pass stream. Add format_events/1,2 for a
one-line-per-event greppable timeline (no state dumps); CT with_trace
always writes that next to the raw ttb dir. Full format/1,2 still dumps
pretty state when needed.
Matrix build on ubuntu-24.04 with rebar3: compile, eunit, and the
structured CT suite (random_netsplits stays quarantined). Upload CT
logs on failure for multi-node post-mortems.
Suites only use locks, gdict/test_cb, and locks_leader; the leader app
from locks-test was never referenced. Remove the test-profile git dep
(local _checkouts link was untracked and already removed).
OTP 29 CI failed g_3.gdict_netsplit when post-heal consensus arrived
at ~6s while wait helpers gave up at 5s; exhausted retry returned a
non-list and lists:usort raised opaque function_clause. Raise wait
budget to 10s, error on retry_exhausted, and re-raise with original
stack from with_trace.
maybe_connect called net_kernel:connect/1, which is gone on modern OTP.
The proxy swallowed undef, so joining peers never connected, elected
alone with empty state, and find(a) timed out. Mesh via connect_nodes,
assert visibility, and wait for leader consensus before state checks.
Fix real issues (opaque gen_server reply tags, dead down/2 clause,
cb_return missing noreply) and extend PLTs so ttb/ct/eunit/dbg are in
scope under the test profile. Add both dialyzer runs to CI.
rebar3 aliases cannot span profiles, so orchestrate compile, default
and test dialyzer, eunit, and ct from make test (alias: make ci).
ttb leaves a binary config in the working directory after CT tracing;
delete any local copy and keep the tree clean after test runs.
OTP 28 CI failed g_5 when Rest (3 nodes) was still mid-election:
usort(info leaders) was [undefined, Pid]. Elect each island fully
before stores/lookups; use wait_find with the full wait budget for
state checks.
Add random-netsplits tc, trace improvements
@uwiger
uwiger merged commit f7a53e5 into master Jul 30, 2026
6 checks passed
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