Title: test-live 偶发失败:保存原生编译目标时返回 java.nativeSettings.failed(约 1/23),错误码无法区分 46 处原因 · Issue #20 · Lithe-IDEA/lithe-plugin-java · GitHub
Open Graph Title: test-live 偶发失败:保存原生编译目标时返回 java.nativeSettings.failed(约 1/23),错误码无法区分 46 处原因 · Issue #20 · Lithe-IDEA/lithe-plugin-java
X Title: test-live 偶发失败:保存原生编译目标时返回 java.nativeSettings.failed(约 1/23),错误码无法区分 46 处原因 · Issue #20 · Lithe-IDEA/lithe-plugin-java
Description: 现象 scripts/compiler/test-live.mjs 的第 3 步 “Save native compiler target and verify real JDT effective settings” 偶发失败,14.7 ms 内直接返回: Error: {"code":-32000,"data":{"code":"java.nativeSettings.failed"},"message":"Reload Java project settings ...
Open Graph Description: 现象 scripts/compiler/test-live.mjs 的第 3 步 “Save native compiler target and verify real JDT effective settings” 偶发失败,14.7 ms 内直接返回: Error: {"code":-32000,"data":{"code":"java.nativeSettings.failed"},...
X Description: 现象 scripts/compiler/test-live.mjs 的第 3 步 “Save native compiler target and verify real JDT effective settings” 偶发失败,14.7 ms 内直接返回: Error: {"code":-32000,"data":{"code":...
Opengraph URL: https://github.com/Lithe-IDEA/lithe-plugin-java/issues/20
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test-live 偶发失败:保存原生编译目标时返回 java.nativeSettings.failed(约 1/23),错误码无法区分 46 处原因","articleBody":"## 现象\n\n`scripts/compiler/test-live.mjs` 的第 3 步 “Save native compiler target and verify real JDT effective settings” 偶发失败,14.7 ms 内直接返回:\n\n```\nError: {\"code\":-32000,\"data\":{\"code\":\"java.nativeSettings.failed\"},\"message\":\"Reload Java project settings and check that their native files are readable.\"}\n```\n\n- 环境:macOS arm64,Temurin/Homebrew OpenJDK 21.0.11,JDT LS 1.61.0(`scripts/prepare-jdtls.sh` 准备的测试版本),unmanaged 项目;插件包为 v3.0.0 草稿发布里下载的 `Lithe-Java-Support-3.0.0-darwin-arm64.zip`。\n- 频率:同一台机器共跑约 23 次(本地构建包 + 下载包,unmanaged/eclipse 两种),失败 1 次;失败那次是解压下载包后的第一次运行,随后 15 次连续复跑都通过。\n- 前两步(发现项目、保存引用 JAR 并确认 JDT 类路径)都已通过,失败发生在 `compiler.settings` → `compiler.prepareSettings(editSource)` 之间。\n\n## 分析(未确认)\n\n`backend/src/project_settings.rs` 的 `fail()` 在 46 处调用,全部返回同一个错误码和文案,日志里也没有原因,所以无法从现有输出判断是哪一处。可能的竞态:\n\n1. `edit` 读到的 `.settings/org.eclipse.jdt.core.prefs` 摘要和 `compiler.settings` 返回的 `revision` 不一致(JDT LS 在上一步更新类路径后异步改写了设置文件);\n2. `compiler.settings` 列出来源时,JDT LS 正处在类路径更新的中间状态,返回的项目路径不在工作区根下,`strip_prefix(&root)` 失败。\n\n对用户的影响:在 JDT LS 刚更新类路径时保存编译设置,可能得到“请重新加载 Java 项目设置”的错误,重试可成功;CI 的 macOS 打包任务会因此偶发失败。\n\n由 #16(2248d64)引入的代码,在 #18 / v3.0.0 发版验证时发现,与 #18 的改动无关(#18 没有改 `project_settings.rs`)。\n\n## 建议方案\n\n1. 先让失败可诊断:`fail()` 区分原因(至少区分“revision 不一致”“路径越界”“读写失败”),并按插件日志规范写一条带原因的日志,错误码对“来源已变化”用单独的码,宿主可以提示重新读取而不是笼统报错。\n2. 再按复现出的原因修根因:如果是 revision 竞态,属于正常并发,应返回“来源已变化”让宿主重新读取;如果是 JDT 中间状态,测试和产品都应等 JDT 类路径更新完成后再列出来源。\n3. 测试按 write-stable-tests 规则改成有界等待,不靠重试掩盖。","author":{"url":"https://github.com/1lck","@type":"Person","name":"1lck"},"datePublished":"2026-11-16T14:39:11Z","url":"https://github.com/Lithe-IDEA/lithe-plugin-java/issues/20"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4e4c0584-0ded-5497-6cc5-39e6640f210e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D9EC:138617:821FA6:B400D2:6B070E01 |
| html-safe-nonce | 98751218cb6bee8377cbdf7180fa921fefa027fce1fd71ae7a9eb59ac022d8c9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUVDOjEzODYxNzo4MjFGQTY6QjQwMEQyOjZCMDcwRTAxIiwidmlzaXRvcl9pZCI6IjE2OTAxOTI3Mzk0MTkyMjk2OTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4034961a31b4da5017a8a1f7624dc26db1525e7c458f85f86c21084a443ab312 |
| hovercard-subject-tag | issue:6423626498 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Lithe-IDEA/lithe-plugin-java/20/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6252f6627fb96f1b43ce1a26bc08b1e24bd4b176aba508cca74e1049671cbc27/Lithe-IDEA/lithe-plugin-java/issues/20 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6252f6627fb96f1b43ce1a26bc08b1e24bd4b176aba508cca74e1049671cbc27/Lithe-IDEA/lithe-plugin-java/issues/20 |
| og:image:alt | 现象 scripts/compiler/test-live.mjs 的第 3 步 “Save native compiler target and verify real JDT effective settings” 偶发失败,14.7 ms 内直接返回: Error: {"code":-32000,"data":{"code":"java.nativeSettings.failed"},... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 1lck |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9aaa1abe1aaef39a8543ab08df7a776c3243275815d741d29afa7b02148ca05e |
| turbo-cache-control | no-preview |
| go-import | github.com/Lithe-IDEA/lithe-plugin-java git https://github.com/Lithe-IDEA/lithe-plugin-java.git |
| octolytics-dimension-user_id | 340144206 |
| octolytics-dimension-user_login | Lithe-IDEA |
| octolytics-dimension-repository_id | 1446370282 |
| octolytics-dimension-repository_nwo | Lithe-IDEA/lithe-plugin-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1446370282 |
| octolytics-dimension-repository_network_root_nwo | Lithe-IDEA/lithe-plugin-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 44c43783771de038e2c401dd343799000e8d1253 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width