question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`GetSignedTokens` goes into retry loop when server responds with `Captcha Required Exception`

See original GitHub issue

Follow up to https://github.com/brave/brave-browser/issues/15600

Race condition when GetSignedTokens goes into retry loop when initially server responds with no captcha for wallet, So captcha is not shown when GetSignedTokens throws a Captcha Required Exception.

Steps to Reproduce

  1. Overwrite https://grant.rewards.bravesoftware.com/v3/captcha/challenge/* to respond with 404 (means no captcha)
  2. Clean profile
  3. Run Brave
  4. Enable Rewards and Ads
  5. Schedule a captcha for your payment ID
  6. Trigger unblinded tokens refill
  7. Observe the logs

Actual result:

GetSignedTokens goes into retry loop when server responds with Captcha Required Exception

[24294:24294:1014/233540.620240:VERBOSE1:refill_unblinded_tokens.cc(116)] Refill unblinded tokens
[24294:24294:1014/233540.620402:VERBOSE1:refill_unblinded_tokens.cc(134)] GetScheduledCaptcha
[24294:24294:1014/233541.386908:VERBOSE1:refill_unblinded_tokens.cc(143)] OnGetScheduledCaptcha
[24294:24294:1014/233541.386957:VERBOSE1:refill_unblinded_tokens.cc(157)] RequestSignedTokens
[24294:24294:1014/233541.386995:VERBOSE2:refill_unblinded_tokens.cc(158)] POST /v1/confirmation/token/{payment_id}
[24294:24294:1014/233541.394233:VERBOSE6:refill_unblinded_tokens.cc(168)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/token/0312abca-fca7-424c-a8bd-82cbd816df23
  Content: {"blindedTokens":["MrmnQhkKWuos1A6B9rcJzqX82iFWrB26r3/RueQ+GF0=","WkVv28UVXL/7jtfcCiUtfNSlYWtVopm8Ro6nVm0Elhc=","dsXDKZWcgzBp5ahKQxid/jJdqWnEkmYR0+HU+Y0erTQ=","0F77bgA6MIt18fTi2eh0iGGUTlpQGeflsYBJAF2FJSM=","mJL++MuTUIGyq8OctaugY2aOXBEvkCQkG8f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l31bFymYklwp0olVXYQpNjEjI=","ugVrfuquyCVlNoAmku/Ajl4Q0M392KvAmCDSwS1c5jk=","trX9It5I4NxB0cC1MxIRQCBSLjHO0MACWvjYE5xd4Q0="]}
  Content Type: application/json
  Method: kPost
[24294:24294:1014/233541.659060:VERBOSE1:refill_unblinded_tokens.cc(178)] OnRequestSignedTokens
[24294:24294:1014/233541.659360:VERBOSE6:refill_unblinded_tokens.cc(180)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/token/0312abca-fca7-424c-a8bd-82cbd816df23
  Response Status Code: 201
  Response: {"nonce":"a29c7ca1-bf5c-4e90-9f00-f5200046668f"}
[24294:24294:1014/233541.659895:VERBOSE1:refill_unblinded_tokens.cc(211)] GetSignedTokens
[24294:24294:1014/233541.660122:VERBOSE2:refill_unblinded_tokens.cc(212)] GET /v1/confirmation/token/{payment_id}?nonce={nonce}
[24294:24294:1014/233541.660365:VERBOSE6:refill_unblinded_tokens.cc(216)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/token/0312abca-fca7-424c-a8bd-82cbd816df23?nonce=a29c7ca1-bf5c-4e90-9f00-f5200046668f
  Method: kGet
[24294:24294:1014/233541.877253:VERBOSE1:refill_unblinded_tokens.cc(226)] OnGetSignedTokens
[24294:24294:1014/233541.877375:VERBOSE6:refill_unblinded_tokens.cc(228)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/token/0312abca-fca7-424c-a8bd-82cbd816df23?nonce=a29c7ca1-bf5c-4e90-9f00-f5200046668f
  Response Status Code: 429
  Response: "Captcha Required Exception"
[24294:24294:1014/233541.879639:INFO:refill_unblinded_tokens.cc(232)] Failed to get signed tokens
[24294:24294:1014/233541.879760:VERBOSE1:refill_unblinded_tokens.cc(385)] Retry refilling unblinded tokens in 0 godzin, 0 minut i 20 sekund at 23:36
[24294:24294:1014/233544.079137:VERBOSE1:browser_manager.cc(65)] Browser window is inactive
[24294:24294:1014/233544.080012:VERBOSE6:user_activity.cc(44)] Triggered event: 17 (7.5:2:3600 s)
[24294:24294:1014/233544.080459:VERBOSE1:browser_manager.cc(99)] Browser did enter background
[24294:24294:1014/233544.080595:VERBOSE6:user_activity.cc(44)] Triggered event: 02 (8:2:3600 s)
[24294:24294:1014/233556.546712:VERBOSE1:confirmations.cc(217)] No failed confirmations to retry
[24294:24294:1014/233601.877892:VERBOSE1:refill_unblinded_tokens.cc(211)] GetSignedTokens
[24294:24294:1014/233601.878010:VERBOSE2:refill_unblinded_tokens.cc(212)] GET /v1/confirmation/token/{payment_id}?nonce={nonce}
[24294:24294:1014/233601.878108:VERBOSE6:refill_unblinded_tokens.cc(216)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/token/0312abca-fca7-424c-a8bd-82cbd816df23?nonce=a29c7ca1-bf5c-4e90-9f00-f5200046668f
  Method: kGet
[24294:24294:1014/233602.103522:VERBOSE1:refill_unblinded_tokens.cc(226)] OnGetSignedTokens
[24294:24294:1014/233602.103609:VERBOSE6:refill_unblinded_tokens.cc(228)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v1/confirmation/token/0312abca-fca7-424c-a8bd-82cbd816df23?nonce=a29c7ca1-bf5c-4e90-9f00-f5200046668f
  Response Status Code: 429
  Response: "Captcha Required Exception"
[24294:24294:1014/233602.104630:INFO:refill_unblinded_tokens.cc(232)] Failed to get signed tokens

GetScheduledCaptcha is not re-scheduled after requests fails Captcha is not shown

Expected result:

The captcha is shown.

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Brave 1.31.85 Chromium: 95.0.4638.50 (Official Build) (64-bit)
Revision 3e9db37693d0cf8e31a89fbcf50401ae91125cef-refs/branch-heads/4638@{#816}
OS Ubuntu 18.04 LTS

cc @emerick @tmancey @jsecretan @brave/legacy_qa @rebron

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
emerickcommented, Oct 23, 2021

@Sneagan fixed this via https://github.com/brave/ads-serve/issues/1743, but let’s keep this issue open until we address https://github.com/brave/brave-browser/issues/18278.

1reaction
Sneagancommented, Oct 22, 2021

@emerick Yes, I’m trying to run this down on the ads-serve side. I’ve put the other details you shared in this issue as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Handling of escaped charecters is different depending on the ...
`GetSignedTokens` goes into retry loop when server responds with `Captcha Required Exception`, 5, 2021-10-19 ; Update default search provider list for South ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found