Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: don't change user CPID if detach from oldest project #5179

Merged
merged 5 commits into from
Apr 13, 2023

Conversation

davidpanderson
Copy link
Contributor

  • Maintain a map from email hash to the oldest user CPID and its time.
    This doesn't change if that project is detached.

  • Write/parse write this in client_state.xml

  • Update it when handling a scheduler reply

  • Use it when sending a scheduler request

  • If, on startup, the map is empty, populate it from PROJECT data.
    This should happen only once, when update to this version

Fixes #5177

- Maintain a map from email hash to the oldest user CPID and its time.
    This doesn't change if that project is detached.

- Write/parse write this in client_state.xml

- Update it when handling a scheduler reply

- Use it when sending a scheduler request

- If, on startup, the map is empty, populate it from PROJECT data.
    This should happen only once, when update to this version
@AenBleidd
Copy link
Member

@KeithMyers, @makeasnek, any chance you could test this?

@makeasnek
Copy link
Member

I have a Windows 10 machine I can test it on if you get me an exe or installer :).

@AenBleidd
Copy link
Member

@makeasnek, we don't have automatically built installer, but we have binaries. Here's a built client for this PR: https://github.com/BOINC/boinc/suites/12005652776/artifacts/630473582
You should stop both BOINC Manager and BOINC client, go to the BOINC installation location (be default it's C:\Program Files\ BOINC), make a backup copy of boinc.exe, and then overwrite it from the archive (please remember you should first extract the content of the archive in some folder, because otherwise Windows might prevent you from copying file to the Program Files directory directly from the downloaded archive.
Please don't forget also to backup your BOINC Data directory (by default located in the hidden folder C:\ProgramData\BOINC) to prevent any possible data loss after you decide to switch back to the original installation version.
After that you could start BOINC Manager again (that should automatically start the client) and test the fix.

@makeasnek
Copy link
Member

Excellent thank you I will test this tomorrow

@KeithMyers
Copy link

@KeithMyers, @makeasnek, any chance you could test this?

I can build it. But how would you set up conditions to test if the fix works? I was thinking that you would have to already have split CPIDs in your client state file. Then run the new client and then see if the split CPIDs were converged to the oldest CPID

Does that sound like the correct test scenario?

@makeasnek
Copy link
Member

makeasnek commented Apr 5, 2023

In each of these tests, I am copying external CPID directly from client_state.xml file and reloading the file into notepad between checks

Test 1:
Add new BOINC project to a host with existing BOINC projects all converged on a single CPID
Result: New project initially has a new CPID. After clicking "update" CPID changed to existing converged CPID

Test 2

  1. Remove all existing projects from BOINC
  2. Create new BOINC account with new e-mail, attach to project A, write down that project's CPID
  3. Create another new BOINC account with same e-mail, attach to project B, write down that project's CPID (this project (GPUGrid) never got an external CPID at all despite having fetched work for it and attempting several force updates, idk why).
  4. Create another new BOINC account with same e-mail, attach to project C, write down that project's CPID (this project got a new CPID, but converged on oldest CPID upon force update),
  5. Verify CPIDs have converged
  6. Remove project A (oldest project) to verify CPID does not change on project C
  7. Verification passed even after doing force update on Project C

So it looks like the intended functionality is working as removing the oldest project does not change CPID. A few things to note here:

  • Even when doing a force update, the "new" CPID given to a boinc client does not automatically converge. I noticed this when a force update ("not requesting tasks don't need") didn't work. It will eventually, but forcing a request doesn't immediately solve issue. Deleting all present tasks and forcing update does seem to work, as it then needs tasks.
  • This "force update" step shouldn't need to be required. I am not well versed enough in the client<->server protocol to know, but is there a way to automatically do a "force update" when a project is added, just to prevent CPID problems? Maybe without actually requesting work?
  • I have attached relevant portions of event log if you want to see what it was saying while all this was happening. I tried a number of projects before I found a project that would let me create account from BOINC manager so the log is a little cluttered as a result.

testnotes.txt

@AenBleidd
Copy link
Member

@davidpanderson, could you please take a look at the test results above?
Thank you in advance

@davidpanderson
Copy link
Contributor Author

I couldn't quite follow the part after "a few things to note".
But I think the issue is:
if you attach to a new project, its web site will show the correct user CPID only after the 2nd scheduler RPC.
That's because:

  • when the client makes the first scheduler RPC, it doesn't know the email addr of the account,
    just the authenticator. So it doesn't send a CPID in the request message.
    The reply message includes the email addr hash.

  • The 2nd scheduler RPC request will include the correct user CPID
    (possibly from an earlier account with the same email addr).

The bottom line: CPIDs converge after 2 RPCs, which should happen pretty quickly.
It's always been this way.
This is as good as we can do without a larger code change.

@makeasnek
Copy link
Member

makeasnek commented Apr 9, 2023

Can we not just issue an "update project" command/second RPC request automatically right after a project is added? That would solve the problem. Here's the scenario I'm envisioning:

  • A person tells their friend about BOINC Games and how they're fun and how they should sign up and join their team to support the cause
  • Their friend downloads BOINC, but they can't join BOINC games because their CPID hasn't synced, so now they have to look up documentation on how to fix their CPID and/or get told to just "wait a while" which could be hours to days depending on how often BOINC would organically make the next RPC request. And they have little visibility into the progress of this since the BOINC manager doesn't show which project has which CPID. <-- This experience is totally avoidable with a force update immediately after adding a project. It would make CPID syncing totally invisible to the user.

@KeithMyers
Copy link

For one thing, the code change you are requesting is in a completely different area of the client code. Do you want to wait some more for a "nice to have" change, or just get the main benefit of the originally asked for improvement merged?

I don't think that a simple manual project update is too much to ask from the new user which achieves the same thing you ask.

Or just wait for the second rpc that is going to happen regardless in a matter of minutes or at most a couple of hours.

@davidpanderson
Copy link
Contributor Author

Actually it doesn't require a 2nd scheduler RPC
It's not that big a change so I'll go ahead and do it.

…) RPC.

That way (if we're already attached to a project with that email addr)
the client can sent the appropriate user CPID in the initial scheduler RPC
and the web site of the project will show it immediately.
@makeasnek
Copy link
Member

Awesome thank you David!

@KeithMyers
Copy link

Thanks for the quick fix David.

@davidpanderson
Copy link
Contributor Author

Seems to work. The test case is:

  • attach to an old project; note the user CPID on the web site
  • attach to a brand-new project using the same email addr
  • after the first RPC to the new project, look at the user CPID
    on its web site; it should be the same

@codecov
Copy link

codecov bot commented Apr 9, 2023

Codecov Report

Merging #5179 (47c2d23) into master (80050f1) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5179   +/-   ##
=========================================
  Coverage     10.86%   10.86%           
  Complexity     1064     1064           
=========================================
  Files           279      279           
  Lines         35993    35993           
  Branches       8258     8258           
=========================================
  Hits           3911     3911           
  Misses        31690    31690           
  Partials        392      392           
Impacted Files Coverage Δ
lib/gui_rpc_client.h 0.00% <ø> (ø)
lib/gui_rpc_client_ops.cpp 0.00% <ø> (ø)

@AenBleidd
Copy link
Member

@makeasnek
Copy link
Member

Tested this situation with the latest build:

  1. Inside BOINC manager, sign up for Amicable numbers, get CPID A
  2. Inside BOINC manager, sign up for Primegrid, get CPID B, which does not equal CPID A. I waited 15 seconds or so in case a new RPC request had to go through first.
  3. After pressing update on Primegrid, CPID B now changes to CPID A

@davidpanderson davidpanderson merged commit 7d3c418 into master Apr 13, 2023
@AenBleidd AenBleidd deleted the dpa_user_cpid branch August 15, 2023 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Option to manually override external CPID
4 participants