Replica registration: editing a host leaves the old replica registered, and deleting one deregisters nothing
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
Research direction
Trace the scaling form and DBSlave class, then inspect the service actions addSlave, removeSlave, and onStarted. Reproduce the registration sequence described in the issue and determine how deletion and existing sessions are handled. Done should mean host edits leave one registration, duplicate registration is prevented, deletion deregisters the replica, and removal has an explicit session outcome.
Written by the indexing model from the issue text.
Description
The scaling form and the DBSlave class are the whole surface for putting a replica into a cluster and taking it out. Four things about it are wrong, and they are filed together because they compound each other and a fix for one changes what the others do.
None of this has been reproduced live — it is read off the behaviour of the service actions and the module that drives them.
1. Editing the host of a replica leaves the old one registered
WHEN CHANGED(host(DBSlave slave)) DO {
asyncRemoveSlave(slave);
asyncAddSlave(slave);
}
Both run in their own session and thread, and both read host after the change, so both see the new value. The removal looks for the new host, which is not registered yet, and therefore removes nothing; the addition then registers it.
The server goes on balancing connections onto a host that is no longer in the configuration, and keeps doing so until it is restarted.
The two threads are also unordered with respect to each other, so the addition can as easily run first.
2. Registering a replica that is already registered is not prevented
addSlave does not check whether that host, or that DBSlave, is already in use. Together with 1 this means editing a host A → B → A leaves two registrations of the same database, each a separate server as far as the rest of the system is concerned.
3. Deleting a DBSlave deregisters nothing
The scaling form offers DELETE, and nothing reacts to it — there is no counterpart to onStarted, which registers everything it finds. The replica stays registered with its subscription enabled and goes on receiving connections until the server is restarted, with no row left anywhere to say it should not be.
4. Removing a replica does not wait for the sessions that are on it
removeSlave disables the subscription and closes its own connection immediately. Sessions that already hold a connection to that replica keep it and keep reading from it — from a database that is no longer receiving changes, so what they read is silently out of date rather than an error. Whether a replica may be removed at all while sessions are still on it is a question nothing currently asks.
Repro (1 and 2)
- Add a
DBSlaveon thescalingform and give it a host, wait for it to come up. - Edit its host to a second one, wait.
- Edit it back to the first.
Expected: one registration, of the host shown on the form. Actual: three registrations accumulated, two of them for the same database.
Why it matters beyond the leak
Two registrations of one database are not just untidy: they make one database look like two to everything that records which server something is on, and each of them has its own connections. A stale registration also keeps a replica in the load balancing after it has been taken out of the cluster on purpose.
- Dominant language
- Java
- Stars
- 214
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lsfusion/platform
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
All issues in lsfusion/platform
Similar issues
-
account assessment course feature lecture
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
app:learninggoalhub enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
PropertyResolver fails on JDK classes with a non-public field named like the propertyPossibly taken @vaibhavgupta443 claimed this today. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/wicket#1991 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100