Skip to content

Commit fa92ef9

Browse files
Jun025jun0claude
authored
[rustjava-tracing-attributes-pin-removal] fix: unfreeze tracing family by replacing the sole #[instrument] with a manual span (#4)
* fix: remove tracing-attributes upper-bound pin by dropping #[instrument] java_runtime carried a direct tracing-attributes = "<0.1.29" dependency to dodge the no_std compile error in tokio-rs/tracing#3388, which froze the whole tracing family at 0.1.41 and made dependabot PRs unresolvable (tracing 0.1.44 requires tracing-attributes 0.1.31, conflicting with the pin). The only code forcing this was a single #[tracing::instrument] in Thread's spawn callback. - thread.rs: replace #[tracing::instrument(name = "java thread", fields(id = self.thread_id), skip_all)] with a manual tracing::info_span! + Instrument combinator (no_std-safe; identical span name, field, level, and target — verified by comparing RUST_LOG output before/after) - java_runtime/Cargo.toml: drop the tracing-attributes direct dep + pin - workspace Cargo.toml: drop tracing's now-unused "attributes" feature - Cargo.lock: tracing family only — tracing 0.1.41 -> 0.1.44 (the previously impossible resolution), tracing-subscriber 0.3.20 -> 0.3.23, tracing-attributes removed from the graph; zero unrelated crates - rust.yml: wasm32 clippy was missing workspace coverage; now --workspace --exclude test_utils (test_utils requires tokio rt-multi-thread, which has a compile_error! on wasm) Verified: cargo test --all green (140 passed), clippy -D warnings clean natively and on wasm32-unknown-unknown (the no_std target the pin existed to protect). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs: update STATE.md/REPORT.md per autonomous-ops SOP Superset content covering all three in-flight PRs so later add/add merges resolve by taking the newest branch's version. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: jun0 <junyoung.choi.a@miraeasset.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 13ab950 commit fa92ef9

7 files changed

Lines changed: 77 additions & 69 deletions

File tree

.github/workflows/rust.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ jobs:
5050

5151
- run: cargo fmt --all -- --check
5252
- run: cargo clippy --all -- -D warnings
53-
- run: cargo clippy --target wasm32-unknown-unknown -- -D warnings
53+
# test_utils requires tokio rt-multi-thread, which does not compile on wasm
54+
- run: cargo clippy --workspace --exclude test_utils --target wasm32-unknown-unknown -- -D warnings
5455
- run: cargo test --all

Cargo.lock

Lines changed: 4 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dyn-hash = { version = "^1.0", default-features = false }
1616
hashbrown = { version = "^0.17", features = ["default-hasher"], default-features = false }
1717
nom = { version = "^8.0", default-features = false, features = ["alloc"] }
1818
parking_lot = { version = "^0.12", default-features = false }
19-
tracing = { version = "^0.1", default-features = false, features = ["attributes"] }
19+
tracing = { version = "^0.1", default-features = false }
2020

2121
tokio = { version = "^1.52", features = ["macros"] }
2222

REPORT.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# REPORT
22

3+
## [2026-07-22] tracing-attributes 상한 핀 제거 (rustjava-tracing-attributes-pin-removal)
4+
- 무엇을: 워크스페이스 유일의 `#[tracing::instrument]`(thread.rs, "java thread" span)를
5+
`tracing::info_span!` + `Instrument` 수동 span 으로 대체하고, `java_runtime`
6+
`tracing-attributes <0.1.29` 직접 의존 핀과 workspace `tracing``attributes` 피처를 제거.
7+
Cargo.lock 은 tracing 계열만 국소 갱신(tracing 0.1.41→0.1.44, subscriber 0.3.20→0.3.23,
8+
tracing-attributes 그래프에서 소멸). wasm32 clippy CI 의 누락 커버리지도 교정
9+
(`--workspace --exclude test_utils` — test_utils 는 tokio rt-multi-thread 라 wasm 불가).
10+
- 왜: 한 줄의 attribute macro 가 no_std 빌드를 깨는 탓(tokio-rs/tracing#3388)에 tracing 계열
11+
전체가 동결됐고 dependabot PR 이 해석 불가로 계속 죽었음.
12+
- 사용자 영향: tracing 계열 업데이트 재개 가능(보안 패치 포함). span 출력("java thread{id=N}"
13+
이름·필드·레벨·타깃)은 실행 대조로 동일함을 확인 — 관측 회귀 0.
14+
- 후속 추천: ① dependabot 재시도 유도(다음 주기에 자동), ② javac 21 익명 내부 클래스 파싱
15+
실패(Malformed) 원인 조사 별건, ③ wasm32 에서 test_utils 대체 테스트 전략 검토.
16+
317
## [2026-07-22] 클래스파일 파싱 실패 → ClassFormatError 전파 (rustjava-classfile-parse-error-propagation)
418
- 무엇을: `ClassInfo::parse``Option``Result<_, ParseError>` 로 바꿔 실패 원인(절단/매직
519
불일치/미지원 상수풀 태그 N/기타 손상)을 담고, `from_classfile``unwrap()`/`assert_eq!`

STATE.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
## 완료
77
- [rustjava-runtime-time-todo-impl] RuntimeImpl 시간 API `todo!()` 3건 제거(now/sleep/yield) +
88
test_utils `r#yield` 구현 + tokio `time` 피처 추가 + 회귀 잠금 픽스처(`test_data/TimeApi`).
9-
★게이트③ 진행: PR #2 approve 핀 `3afb6cc` 확인 → main(549b9eb) 충돌 해소(STATE/REPORT
10-
superset, docs-only) 후 스쿼시 머지(2026-07-23).
9+
★게이트③ 완료: PR #2 스쿼시 머지 → main `13ab950`(2026-07-23), 브랜치 정리 완료.
1110
- [rustjava-classfile-parse-error-propagation] 클래스파일 파싱 실패를 패닉 대신
1211
`java.lang.ClassFormatError` 로 전파(절단/매직 불일치/미지원 상수풀 태그 구분).
1312
★게이트③ 완료: PR #3 스쿼시 머지 → main `549b9eb`(2026-07-23), 브랜치 정리 완료.
1413
- [rustjava-tracing-attributes-pin-removal] `#[tracing::instrument]` 1건을 수동 span 으로 대체,
1514
`tracing-attributes` 상한 핀 제거(tracing 0.1.41→0.1.44 언프리즈), wasm32 clippy CI 커버리지
16-
교정. 브랜치 `tracing-attributes-pin-removal`, PR 게이트② 대기.
15+
교정. ★게이트③ 완료: PR #4 approve 핀 `0a19f38` 확인 → main 충돌 해소(docs-only) 후
16+
스쿼시 머지(2026-07-23), 브랜치 정리 완료.
1717
- [rustjava-unsupported-charset-exception] 미지원 charset `unimplemented!()` 패닉 3지점을
1818
`java.io.UnsupportedEncodingException`(신설) throw 로 전환, String↔InputStreamReader 지원
1919
charset 을 공용 `charset::Charset` 으로 일치(ISO-8859-1/US-ASCII 가 Reader 에서도 동작).
@@ -22,10 +22,9 @@
2222
`unsupported-charset-exception`, PR #5 게이트② 대기.
2323

2424
## 다음
25-
- 잔여 PR 게이트② approve 후 머지: tracing-attributes-pin-removal, #5(unsupported-charset).
26-
브랜치 정리(`gh pr merge --delete-branch``git branch -D``git fetch --prune`)
27-
- ★잔여 PR 도 STATE.md/REPORT.md add/add·수정 충돌 예상 — 선행 머지 후 후행 브랜치에
28-
`git merge main` 하고 최신(superset) 내용 채택으로 해소.
25+
- 잔여 PR: #5(unsupported-charset) 게이트② approve 후 머지, 브랜치 정리
26+
(`gh pr merge --delete-branch``git branch -D``git fetch --prune`)
27+
-#5 착지 전 후행 브랜치에 `git merge main` + superset 채택으로 STATE/REPORT 충돌 해소.
2928
- ★PR 발권 시 `--repo Jun025/RustJava` 명시(2026-07-22 upstream 오발행 사고 재발 방지).
3029
- (범위 밖 잔여) `jvm_rust/src/interpreter.rs:629` `todo!()` (invokedynamic) — 별건 티켓 필요
3130
- (신규 발견) javac 21 산출 익명 내부 클래스(.class)가 "Malformed class file" 로 파싱 실패 —

java_runtime/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ tracing = { workspace = true }
1414

1515
chrono = { version = "^0.4", default-features = false }
1616
encoding_rs = { version = "^0.8", features = ["alloc"], default-features = false }
17-
tracing-attributes = { version = "<0.1.29" } # Pin this to avoid compile error with no-std https://github.com/tokio-rs/tracing/issues/3388
1817
url = { version = "^2.5", default-features = false }
1918
zip = { version = "^8.6", features = ["deflate"], default-features = false }
2019

java_runtime/src/classes/java/lang/thread.rs

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use core::time::Duration;
44
use java_class_proto::{JavaFieldProto, JavaMethodProto};
55
use java_constants::MethodAccessFlags;
66
use jvm::{ClassInstanceRef, Jvm, Result, runtime::JavaLangString};
7+
use tracing::Instrument;
78

89
use crate::{RuntimeClassProto, RuntimeContext, SpawnCallback, classes::java::lang::Runnable};
910

@@ -87,50 +88,57 @@ impl Thread {
8788

8889
#[async_trait::async_trait]
8990
impl SpawnCallback for ThreadStartProxy {
90-
#[tracing::instrument(name = "java thread", fields(id = self.thread_id), skip_all)]
9191
async fn call(&self) -> Result<()> {
92-
tracing::trace!("Thread start");
93-
94-
self.jvm.attach_thread()?;
95-
96-
let result: Result<()> = self.jvm.invoke_virtual(&self.this, "run", "()V", []).await;
97-
98-
if let Err(jvm::JavaError::JavaException(x)) = result {
99-
let string_writer = self.jvm.new_class("java/io/StringWriter", "()V", ()).await.unwrap();
100-
let print_writer = self
101-
.jvm
102-
.new_class("java/io/PrintWriter", "(Ljava/io/Writer;)V", (string_writer.clone(),))
103-
.await
104-
.unwrap();
105-
106-
let _: () = self
107-
.jvm
108-
.invoke_virtual(&x, "printStackTrace", "(Ljava/io/PrintWriter;)V", (print_writer,))
109-
.await
110-
.unwrap();
111-
112-
let trace = self
113-
.jvm
114-
.invoke_virtual(&string_writer, "toString", "()Ljava/lang/String;", [])
115-
.await
116-
.unwrap();
117-
118-
tracing::error!(
119-
"Uncaught exception in thread {}:\n{}",
120-
self.thread_id,
121-
JavaLangString::to_rust_string(&self.jvm, &trace).await.unwrap()
122-
);
123-
} else {
124-
result?;
92+
// manual span instead of #[tracing::instrument]: tracing-attributes breaks no_std
93+
// builds (tokio-rs/tracing#3388), and this was the only use in the workspace
94+
let span = tracing::info_span!("java thread", id = self.thread_id);
95+
96+
async {
97+
tracing::trace!("Thread start");
98+
99+
self.jvm.attach_thread()?;
100+
101+
let result: Result<()> = self.jvm.invoke_virtual(&self.this, "run", "()V", []).await;
102+
103+
if let Err(jvm::JavaError::JavaException(x)) = result {
104+
let string_writer = self.jvm.new_class("java/io/StringWriter", "()V", ()).await.unwrap();
105+
let print_writer = self
106+
.jvm
107+
.new_class("java/io/PrintWriter", "(Ljava/io/Writer;)V", (string_writer.clone(),))
108+
.await
109+
.unwrap();
110+
111+
let _: () = self
112+
.jvm
113+
.invoke_virtual(&x, "printStackTrace", "(Ljava/io/PrintWriter;)V", (print_writer,))
114+
.await
115+
.unwrap();
116+
117+
let trace = self
118+
.jvm
119+
.invoke_virtual(&string_writer, "toString", "()Ljava/lang/String;", [])
120+
.await
121+
.unwrap();
122+
123+
tracing::error!(
124+
"Uncaught exception in thread {}:\n{}",
125+
self.thread_id,
126+
JavaLangString::to_rust_string(&self.jvm, &trace).await.unwrap()
127+
);
128+
} else {
129+
result?;
130+
}
131+
132+
self.jvm.detach_thread()?;
133+
134+
let mut this = self.this.clone();
135+
self.jvm.put_field(&mut this, "alive", "Z", false).await.unwrap();
136+
self.jvm.object_notify(&self.this, usize::MAX);
137+
138+
Ok(())
125139
}
126-
127-
self.jvm.detach_thread()?;
128-
129-
let mut this = self.this.clone();
130-
self.jvm.put_field(&mut this, "alive", "Z", false).await.unwrap();
131-
self.jvm.object_notify(&self.this, usize::MAX);
132-
133-
Ok(())
140+
.instrument(span)
141+
.await
134142
}
135143
}
136144

0 commit comments

Comments
 (0)