fix(android): 去掉诊断记录的对象锁,消除本地诊断数据库死锁导致心跳停止 #386
Open
opened 2026-10-13 09:14:35 +08:00 by ila
·
5 comments
No Branch/Tag Specified
main
feat/387-cancel-by-device
fix/386-diagnostic-deadlock
fix/385-accessibility-pause
feat/384-client-key-agent-release
feat/383-collection-device-filter
feat/382-purchase-creator-filters
feat/381-syb-cancelled-block
feat/375-open-in-pdd
feat/380-status-device-connection
fix/370-horizontal-grid
feat/372-export-shop
feat/378-heartbeat-diagnostics
feat/372-export-price
feat/372-list-export
fix/377-rejected-purchase-outbox
fix/376-pre-address-spec-verification
fix/374-final-spec-confirmation
fix/373-navigation-diagnostics
fix/370-color-discovery
feat/367-last-batch-repurchase
fix/368-image-search-partial-link
integration/364-365-366-main
feat/364-purchase-failure-snapshot
integration/365-366-validation
fix/365-order-result-observation
fix/366-address-editor-ready
fix/359-auto-match-resume
feat/363-inner-code-page-size
fix/362-truncated-spec-card
fix/361-spec-probe-click
docs/agents-worktree-rules
fix/358-syb-size-weight
feat/357-syb-cancel-status
feat/356-purchase-order-filter
fix/355-syb-list-timeout
feat/353-syb-shop-multiselect
fix/354-syb-top-pagination
fix/352-syb-source-created
fix/348-reveal-swipe
feat/340-syb-excluded-products
fix/351-inner-code-apply-selection
fix/350-match-layout
fix/350-inner-code-matching
feat/349-batch-return-use
feat/347-batch-return-cancel
feat/345-yeeke-reship
fix/346-root-serves-spa
fix/344-inner-code-stall-match
fix/343-syb-writeback-session
feat/339-syb-page-size
feat/338-return-match
feat/337-yeeke-admin-ui
feat/336-yeeke-return-sync
fix/335-bottom-submit-node
fix/334-spec-probe-top-swipe
fix/333-purchaser-device-owner
fix/331-spec-panel-recognition
fix/330-syb-writeback-session
feat/327-syb-writeback-filter
feat/326-order-information
fix/325-order-result
feat/316-chrome-order-backfill
fix/307-backfill-entry
feat/305-syb-order-writeback
feat/306-order-paid-amount
release/283
fix/283-purchase-mapping-consistency
fix/230-horizontal-spec-selection
feat/263-spec-rematch
fix/262-purchase-handoff
fix/260-261-purchase-readiness
fix/259-partial-collection-link
feat/258-one-click-replace
fix/257-color-normalized-match
fix/256-collection-single-dimension
fix/255-current-page-reidentify
feat/253-one-click-link
fix/254-match-loading
fix/251-syb-spec-candidates
feat/250-continuous-collection
fix/249-local-purchase-diagnostics
fix/248-bottom-submit
fix/247-short-address-panel
fix/246-address-return-panel
fix/245-purchase-failure-diagnostics
fix/244-selected-card-duplicates
fix/243-spec-entry-recovery
feat/242-agent-order-backfill
feat/241-order-backfill-endpoint
fix/239-syb-partial-sync
fix/238-spec-panel-preswipe
feat/237-client-api-keys
feat/236-purchaser-syb-sync
fix/235-syb-pagination-overlap
release/234-integrated
fix/229-address-entry-dedup
fix/228-selection-proof-panel-transition
fix/227-address-panel-return
fix/226-reopen-pdd-on-manual-retry
fix/225-in-place-purchase-retry
fix/224-final-spec-revalidation
fix/223-probed-confirmed-mapping
chore/221-devharness-sync
feat/218-purchase-result-bubble
fix/217-agent-retry-current-spec
fix/216-syb-spec-role-order
feat/215-mandatory-live-spec-probe
feat/214-verified-purchase-actions
fix/212-syb-sync-shop-snapshot
feat/211-spec-entry-ready-wait
feat/210-order-result-payment-transition
feat/209-pdd-bottom-spec-entry
feat/200-ai-match-result-purchase-ready
feat/199-job-execution-logs
feat/198-syb-ai-parse
feat/195-scheduled-spec-auto-match
fix/197-ai-write-timeout
feat/190-syb-inline-correction
fix/193-address-entry-reveal
feat/194-one-click-spec-match
fix/192-order-result-scroll
No results found.
Labels
No items
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: OPC/goauto#386
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
基本信息
已核验事实(2026-10-13)
现场(采购1,设备 #8,PKG110,Agent 0.9.69-373-fix1;只读查询与 adb 检查)
completed(说明当时网络正常);Agent 常驻通知一直停在 19:11:56 的「任务 #3004 失败」。maintainFailureSnapshots,每 60 秒)PurchaseFailureSnapshotStore.transaction已beginTransaction,事务内execute→helper.writableDatabase(PurchaseFailureSnapshotStore.kt:9)AgentDiagnosticStore对象锁diagnosticExecutor)AgentDiagnosticStore.record()(@Synchronized)→beginTransaction(:179)AgentDiagnosticStore对象锁SQLiteConnectionPool.waitForConnection)executor)SyncDiagnosticRecorder.begin→AndroidSyncSql→diagnosticStore.writableDatabase(AgentForegroundService.kt:150)AgentDiagnosticStore对象锁working标记一直不被清除,后续心跳全部跳过,因此 Admin 显示离线,而手机界面看起来正常。代码(
origin/maind4cf2bb,即 0.9.70,仍有同样问题)persistence/AgentDiagnosticStore.kt:169@Synchronized fun record(...):方法内只用到局部变量和db,写入、回读和清理在同一个事务中完成,没有需要对象锁保护的共享字段;唯一调用方在单线程执行器中(AgentForegroundService.kt:157)。PurchaseFailureSnapshotStore.transaction/execute/query,以及SyncDiagnosticStore(AndroidSyncSql.transaction→open())。这两条只在事务内短暂调用writableDatabase/readableDatabase,数据库已打开时会立即返回,不会持有对象锁等待写连接。AgentDiagnosticStore中没有其他@Synchronized或synchronized(this)。目标
消除 Agent 本地诊断数据库的死锁,避免同步/心跳线程永久阻塞。
非目标
PurchaseFailureSnapshotStore、SyncDiagnosticStore、FailureSnapshotRepository。方案
删除
AgentDiagnosticStore.record()上的@Synchronized。不再有线程「持有对象锁并等待写连接」,消除加锁顺序倒置。多个事务由 SQLite 写连接自动排队,数据一致性不受影响。设计证据
无界面变化,不需要原型。
子项目影响、依赖与并行
persistence/AgentDiagnosticStore.kt一行。验收标准
风险与回退
record()的调用方本来就是单线程。文档影响
无长期文档影响:内部并发缺陷修复,不改变入口、配置、接口、数据结构或业务规则。
2026-10-13 开始实施(Claude Code)
fix/386-diagnostic-deadlock,worktreeD:/OPC/goauto-worktrees/issue-386,基线origin/maind4cf2bb。2026-10-13 实现与合并(Claude Code)
实现
fix/386-diagnostic-deadlock,提交71165b1:只删除AgentDiagnosticStore.kt中record()上的@Synchronized(1 行)。testDebugUnitTest assembleDebugBUILD SUCCESSFUL,815 个用例,0 失败。合并与装机
d4cf2bb..328afde7c0d37bmerge fix(android): 无障碍未就绪时暂停领取任务,并在状态 Tab 与弹窗提示 (#385)afa03efmerge fix(android): 去掉诊断记录的对象锁,消除本地诊断数据库死锁导致心跳停止 (#386)328afde版本升到 0.9.71(versionCode 84)testDebugUnitTest assembleDebug:BUILD SUCCESSFUL,822 个用例,0 失败,0 错误,0 跳过。3eab2527dc3ce592fe22f2f8cc31e4d0fa07dd1fa54b6209948ea6ce9cd7c4f6;APK SHA-256 为10ad5a2b898230897b15a54f73212ae56a11fcf2f73beffc0392321699d7cf00。3B668T01GF400000(PLY110)装机前核对了序列号,install -r成功:0.9.70(83)→ 0.9.71(84),2026-10-13 09:29:28。采购1、采购2 未动。待验证与局限
状态:待验收。
2026-10-13 装采购1(Claude Code)
3B65BD02H7F00000,PKG110)。bf86d746…766dec,与测试机用的 debug keystore(3eab2527…)不同;328afde构建重新签名,证书核对一致;APK SHA-256 为3004cda3784182381e98ce9953cabcdba4017eb535c8578a2b317b3a7303e6ab。install -r成功:0.9.69-373-fix1(82)→ 0.9.71(84),2026-10-13 09:35:01。没有卸载,本地凭据和数据保留。2026-10-13 Wiki:装机签名对照(Claude Code)
37630e95b7e03248546467826525f45921033f74,回读一致。sync、一次sync --check均通过,镜像提交59a483f已推送 main(328afde..59a483f)。bf86…,结果不受影响。2026-10-13 Claude Code:采购2 装机 0.9.71
经用户授权(「把最新版apk安装到采购2,192.168.0.9:33585」),在采购2(设备 #7,PLY110,序列号核对为
3B663A00JW500000)上覆盖安装 0.9.71(versionCode 84,main328afde构建;此后 main 的 Android 代码没有变化)。bf86d746…766dec;线上该设备没有待执行或执行中的采集任务和采购任务,心跳正常。adb install -r成功(不卸载),装后版本为0.9.71/84;APK SHA-2563004cda3…03e6ab。