Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 25 18:36
    renovate[bot] edited #496
  • Nov 25 15:57
    renovate[bot] edited #496
  • Nov 25 15:57
    renovate[bot] edited #572
  • Nov 25 15:57
    renovate[bot] synchronize #572
  • Nov 25 15:57

    renovate[bot] on org.slf4j-slf4j-simple-2.x

    Update dependency org.slf4j:slf… (compare)

  • Nov 25 15:57
    renovate[bot] opened #591
  • Nov 25 15:57

    renovate[bot] on gradle-7.x

    Update dependency gradle to v7.6 (compare)

  • Nov 17 22:24
    renovate[bot] edited #572
  • Nov 17 22:24
    renovate[bot] synchronize #572
  • Nov 17 22:24

    renovate[bot] on org.slf4j-slf4j-simple-2.x

    Update dependency org.slf4j:slf… (compare)

  • Nov 14 19:47
    renovate[bot] edited #590
  • Nov 14 19:47
    renovate[bot] edited #589
  • Nov 14 13:58
    renovate[bot] edited #496
  • Nov 14 13:58
    renovate[bot] opened #590
  • Nov 14 13:58

    renovate[bot] on org.openjdk.jmh-jmh-generator-annprocess-1.x

    Update dependency org.openjdk.j… (compare)

  • Nov 14 13:58
    renovate[bot] opened #589
  • Nov 14 13:58

    renovate[bot] on org.openjdk.jmh-jmh-core-1.x

    Update dependency org.openjdk.j… (compare)

  • Nov 11 22:03

    jbachorik on improved_linking

    Fix remapping arrays and improv… Use spotless plugin WIP and 1 more (compare)

  • Nov 11 22:01

    jbachorik on load_only_supported_probefiles

    (compare)

  • Nov 10 18:06
    renovate[bot] edited #496
Joachim Haagen Skeie
@joachimhs
I found a few bugs (or at least some inconsistencies with the previous versions of BTrace) related to the TimeBasedRollingFileWriter. Created PR: btraceio/btrace#221
Jaroslav Bachorik
@jbachorik
@TimKack yes, 'printMap' is the correct way to print the properties
Jaroslav Bachorik
@jbachorik
@joachimhs There actually seem to be more problems here - the compiler throws NPE when trying to process the diagnostic info. The diagnostic info contains parts generated by 'btracec' but those parts don't map correctly to source. And the last thing is that BTrace compiler reports 'Sys.Memory.getMemoryPoolUsage(str(sb))' as unsafe call. I will have to investigate what is causing this misbehavior.
Joachim Haagen Skeie
@joachimhs
ok. @jbachorik in the interim I commented out the line in my script which is an OK temporary solution
Jaroslav Bachorik
@jbachorik
@joachimhs About that Sys.Memory.getMemoryPoolUsage() problem - btraceio/btrace#222
Joachim Haagen Skeie
@joachimhs
@jbachorik Looks good! Thanks. I am working on finishing Montric and releasing it in August
Jakub Dziworski
@JakubDziworski

Hi! I'd like to debug agent, but somehow I am unable to do that.

In the Client when the agent is loaded (vm.loadAgent(agentPath, agentArgs);) I added additional arguments:

agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005

The console prints:

DEBUG: agent args: agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005,port=2020,statsd=,debug=true,bootClassPath=.,systemClassPath=/opt/oracle_jdk/jre/../lib/tools.jar,probeDescPath=.

but the agent does not expose debugger port.

Did I provided args in wrong format, or is there any other problem?

@jbachorik @joachimhs
Ghost
@ghost~56c6d141e610378809c23db4
greetings greetings
i'm trying to find any manuals on how to start actually using btrace for writing custom agent
no success so far
Jaroslav Bachorik
@jbachorik
@JakubDziworski When I need to debug the agent I just run the target application with the debugger settings - eg. I can run a java application in debug mode from an IDE and then attach btrace. When you have the sources available and you put breakpoint inside the BTrace code you can debug it.
Hi @nfx , have you tried https://github.com/btraceio/btrace/wiki ?
Jaroslav Bachorik
@jbachorik
@JakubDziworski Your approach will not work since you are trying to expose agent (debugger) from within another agent (btrace). You really need to start that JVM with debugger agent (and possibly btrace agent if you are loading btrace at JVM startup)
Tim Käck
@TimKack
@jbachorik I just wanted to say a big Thank You for the work you and A Sundararajan done with BTrace. Today it has facilitated a database connaction pool monitoring in our application (exposing it as MBeans).
With the @sampled annotation we can make sure that we are causing very little overhead as well (a connection pool is a high contention area)!
Jaroslav Bachorik
@jbachorik
@TimKack Glad to hear that! If you have any requests or ideas about BTrace, don't hesitate to speak up either here or on GitHub.
Simon
@Gikkman
Hi.
I got curious if it was possible to use VisualVM to remotely use bTrace probes (such as checking sort frequency). After a few hours of searching, I did come across an old Kenai post about it from 2014 where it was discussed, but I haven't seen anything since. Is it possible today, or was that idea abandoned?
Iwan Aucamp
@aucampia
hi
so when I search for btrace I find this at the top: https://kenai.com/projects/btrace
and that is no longer being maintained - can that somehow be removed ?
Jaroslav Bachorik
@jbachorik
@aucampia I don't know. Kenai.com has been in read-only mode for several years and it is in undead mode when no changes are allowed :/ If you know how to unindex something from google that might help ...
Tim Käck
@TimKack
Hi, is there a way to get the value from an aggregation without turning on unsafe? I.e. I have an aggregation with AggregationFunction.AVERAGE and ultimately I'd like to do a myAggregation.getValueForKey(myAggrKey)
(I can solve this case with a simple counter and add to an AtomicLong but more for complex aggregations)
Jaroslav Bachorik
@jbachorik
@TimKack Currently, only printing the whole aggregation structure is supported. Please, feel free to file an RFE for retrieving single aggregation values, it should be fairly easy to add. Until then you will need to enable unsafe mode.
Tim Käck
@TimKack
@jbachorik - thank you. I'll open a RFE or create a pull request.
But now I have another question :) - I cannot seem to understand how Kind.CATCH works. I want to catch ClassNotFoundExceptions thrown in java.net.URLClassLoader.findClass(String) but it seems to ignore the instrumentation.
I have followed traces.onmethod.Catch test case
Jaroslav Bachorik
@jbachorik
@TimKack The Kind.CATCH is for instrumenting the 'catch' block - is that the scenario. For uncaught exceptions you would use Kind.ERROR instead.
Tim Käck
@TimKack
I cannot seem to figure out how where to put arguments to my script when loaded as an agent. When using the client I access them via Sys.$(x) but how would I go about when using the btrace-agent?
Jaroslav Bachorik
@jbachorik
Currently this is not possible. The functionality is missing - the agent arguments are not forwarded to runtime.
Jaroslav Bachorik
@jbachorik
@TimKack What would be the expected behaviour - Sys.$(x) would provide access to the agent arguments, eg. -javaagent:btrace-agent.jar=arg1=val1,arg2=val2,... would make arguments 'val1' and 'val2' accessible to the probe?
@TimKack btraceio/btrace#295 - please, add there any comments about required functionality
Tim Käck
@TimKack
@jbachorik - no comments needed - you perfectly describe the enhancement. I added a comment that it would be fantastic to retrieve the value from named parameters
Tim Käck
@TimKack

But I have a somewhat basic question, consider this: I have a private variable private Context CROSS_THREAD_CONTEXT_FOR_UNIT_TEST = null; and I want to modify this variabe on a method call. Basically I have production code running

private void setCrossThreadContextForUnitTests( Context context )
  {
    CROSS_THREAD_CONTEXT_FOR_UNIT_TEST = context;
  }

I want to intercept and set context to null. How would I do that (I understand it has to be unsafe mode). Do I need to reflect on @Self somehow?

Jaroslav Bachorik
@jbachorik
Unfortunately, reflection is the only way right now. Could be interesting to consider an enhancement for FIELD_SET interception where the probe method could return a value that should be used instead of the provided one (we do something similar for method return values - of course this is enabled only in unsafe mode)
Or a generic DSL/API allowing manipulation of method arguments on method entry ...
Tim Käck
@TimKack
Cheers - reflection it is. I agree, FIELD_SET instrumentation seems to be the most logical place to put such an enhancement. This is not really hot swapping the argument though as there might be many FIELD_SETs in an instrumented method. Perhaps both? One argument DSL for Kind.ENTRY and one for FIELD_SET?
BIN@Captain
@captainfod
hi,everyone,there is a question about btrace that I want to know what the btrace open source license is?
plz,now I plan to develope a java-profiling tool which includes the btrace project
Jaroslav Bachorik
@jbachorik
Hi @captainfod - the license is GPLv2 with ClassPath exception (like (Open)JDK)
bonaluo
@bonaluo
I cant build btrace with gradle . I download the source code btrace-2.0.2
image.png
Jaroslav Bachorik
@jbachorik
@bonaluo Did you do source config_build.sh as instructed in the README.md?
It sets up all necessary env variables - BTrace needs to be built and tested on several versions of JDK so the pre-build setup is a bit more complex.
Thomas Dullien
@thomasdullien
good day :-)
I am trying to use Btrace on elasticsearch, which has a security manager
a friend recommended I try to instrument the AccessManager and hence work past the security manager
is there a way to tell btrace to modify the return value of a given function?
Jaroslav Bachorik
@jbachorik
There is a hidden functionality in BTrace which allow you to this.
But you need to run the agent in 'trusted' mode and also mark the script as @Trusted
Then the only thing you need is to change the return type of the BTrace probe method to the return type (or supertype of) of the intercepted method and return the desired value.
Of course, you can mess up the rest of the application easily if eg. the code depends on the concrete type of the returned value and you change it - so you should test the script before using this in production like env.
Kushal Chordiya
@kushal-ti
hi, I'm experimenting with using Btrace with MDC. Basically, on method entry i want to print out some basic info, like the methodName and arguments and also pull some data from MDC and add it to the string i'm printing. Does anyone know how to go about this? Will i have to add a library with an MDC implementation like log4j to the btrace agent and compile it into a single jar, or is there an easier way to do this? I read about the TLS annotation for thread-local BTrace fields but could not find any examples regarding the same or if i could use it to extract values out of MDC