Skip to content

Commit

Permalink
Merge pull request #624 from bytedance/fix-jattach-notfound
Browse files Browse the repository at this point in the history
Fix jattach notfound
  • Loading branch information
yoloyyh authored May 24, 2024
2 parents 42f16f9 + caa63bf commit ac4b48c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,9 @@ public String call() throws Exception {
SmithAgentLogger.logger.warning(proberPath + " loading fail!");
}
else {
System.setProperty("smith.rasp", probeVersion+"-"+checksumStr);
System.setProperty("smith.status", "attach");
System.setProperty("smith.rasp", probeVersion+"-"+checksumStr);

System.setProperty("rasp.probe", "smith");
}
}
Expand Down
5 changes: 3 additions & 2 deletions rasp/librasp/src/jvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use log::*;
use regex::Regex;
use std::process::Command;
use std::fs;

use std::thread;
use std::time::Duration;
use crate::async_command::run_async_process;
use crate::process::ProcessInfo;
use crate::runtime::{ProbeCopy, ProbeState, ProbeStateInspect};
Expand Down Expand Up @@ -71,7 +72,7 @@ pub fn java_attach(pid: i32) -> Result<bool> {
if err.len() != 0 {
info!("{}", &err);
}
//thread::sleep(Duration::from_millis(100));
std::thread::sleep(Duration::from_millis(500));
match check_result(pid, "attach") {
Ok(_) => {
return Ok(true);
Expand Down
3 changes: 2 additions & 1 deletion rasp/librasp/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,9 @@ impl RASPManager {
diff_ns = value;
if diff_ns {
let to = format!("{}{}",root_dir.clone(), settings::RASP_JAVA_AGENT_BIN());
self.copy_file_from_to_dest(settings::RASP_JAVA_JATTACH_BIN(), root_dir.clone());
self.copy_file_from_to_dest(settings::RASP_JAVA_AGENT_BIN(), root_dir.clone());
info!("copy from SmithAgent.jar to {}", to.clone());
info!("copy from jattach/SmithAgent.jar to {}", to.clone());
}
}
Err(e) => {
Expand Down

0 comments on commit ac4b48c

Please sign in to comment.