Repository navigation
fix: pass Platform request timeouts to platform-mobile in seconds - #45
Conversation
DapiClient keeps timeOut in milliseconds (DEFAULT_TIMEOUT = 5000) but handed it unchanged to platformMobileSdkCreateDashSdkWith*, whose RequestSettings use Duration::from_secs. Every request therefore ran with a 5000s timeout and a 10000s connect timeout, so a DAPI node that accepts a connection and then stalls could hold a call for over an hour per retry. Convert with millisToSdkSeconds(), which rounds up and never returns 0 (a zero Duration would time out every request). Defaults now reach the SDK as 5s request / 10s connect. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Test results: mainnet, Android emulatorsThe fix works on mainnet. A request to an unresponsive node now ends at the configured limit (5 s on an open connection, 10 s on a new one), and the SDK bans that node and retries elsewhere. Without the fix, one dead node stalled the DashPay contacts sync for 74 s. Builds
Both apps had a DashPay identity (a different one on each emulator) and synced against mainnet. What was tested
ResultsDead node behaviour
On the QA build, 4 of 238 requests reached a blocked node. Each was cut off at its limit and banned, and the retry went out 0.01 s later. The other 234 requests took at most 1.10 s (median 0.19 s), and none were left unfinished. Normal use, no dead nodes involved: no change. Median request time was 0.17–0.19 s on both builds. DashConnect: the flow's Platform calls ( Things worth knowing
Not covered
|
The unit mismatch this PR fixes came from unlabelled `usize` timeout parameters. Doc-comment them as seconds in sdk.rs and config.rs, label DEFAULT_TIMEOUT as milliseconds, and convert in the commented-out create call so it isn't copied back with milliseconds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* chore: prepare 5.0.2 Maven Central release 5.0.2 = 5.0.1 + #45 (SDK timeouts passed in seconds) and #46 (refreshed mainnet evonode lists). Same Platform pin (platform-revision.txt) and dashj 24.0.0 as 5.0.1. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore: set dash-sdk-bindings and platform-mobile crate versions to 5.0.2 The release commit bumped only the Android bindings crate. The desktop dash-sdk-bindings crate was still 5.0.1 and platform-mobile had stayed at 4.0.1 since that release. No code reads these versions, so the published 5.0.2 artifacts are unaffected; this keeps the repo consistent. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Problem
DapiClientkeepstimeOutin milliseconds (DEFAULT_TIMEOUT = 5000L; the same value is used withTimeUnit.MILLISECONDSinDAPIGrpcMasternode). It was passed unchanged toplatformMobileSdkCreateDashSdkWithNetwork/WithContext, andplatform-mobilebuildsRequestSettingswithDuration::from_secs(sdk.rs,config.rs).So every Platform request ran with a 5000s request timeout and a 10000s connect timeout, with 10 retries. The SDK logs this on every call:
A DAPI node that accepts the connection and then stalls can hold a call for well over an hour per retry; only the HTTP/2 keep-alive cuts some of these short. In the wallet this shows up as DashConnect requests that never reach the approve dialog: a thread dump 28s after one tap had 11 Platform calls still blocked in
getIdentity/refreshProtocolVersion/getPlatformTime.The mismatch dates from the original
platform-mobilecommit (ac3e29d).Fix
millisToSdkSeconds()converts the millisecond timeouts to whole seconds before both SDK constructors. It rounds up and never returns 0, which would time out every request.SdkTimeoutTestcovers the defaults, rounding up, and the zero/negative cases.Testing
./gradlew :dpp:test --tests org.dashj.platform.dapiclient.SdkTimeoutTest: 3/3 pass.🤖 Generated with Claude Code