Comments (5)
Unfortunately, this is a complex problem :(
For anything like 'computeIfAbsent' we would need to have support for lambdas and that is not trivial (probably doable, but requiring carefully designing the APIs and then implementation, of course).
If you need the synchronization now you can do @BTrace(trusted = true)
to turn the safety verification off and then it is up to you to make sure you are not going to deadlock the traced app.
from btrace.
Unfortunately, this is a complex problem :(
For anything like 'computeIfAbsent' we would need to have support for lambdas and that is not trivial (probably doable, but requiring carefully designing the APIs and then implementation, of course).
Having said that, I have been pondering nicer APIs with Java 8 features for some time (eg. we could do iterations on collections as they would be guaranteed to be bounded etc.)
from btrace.
First of all, thanks for you always answering so promptly!
If I interpret your answer correctly, it seems that no synchronization happens at all between methods like onnewObject.
This would mean that access from several threads could not only produce false results in my example, but also crash the traced applications if unsafe MT access wrangles up some internal data structures.
So the HistoOnEvent example would be correct as the used Swing class is intended to use in a single threaded way, but is unsafe for general use. Therefore I think it would be good to add this information to the javadoc.
Then probably a more general example with @btrace(trusted=true) should be added showing MT-safety can be achieved in a general way.
I was also looking for general documentation about the MT behavior of the traced code, but this seems to be missing.
Also the mentioned annotation parameters of @btrace are not documented in the Wiki.
I was also looking for the source code in the btrace-client-2.2.-sources.jar, but the JAR does not contain the sources.
As this JARs is downloaded by Maven to provide sources, it would be good if they would be contained.
from btrace.
First of all, thanks for you always answering so promptly!
Not at all. It is refreshing to have engaging users :)
If I interpret your answer correctly, it seems that no synchronization happens at all between methods like onnewObject.
This would mean that access from several threads could not only produce false results in my example, but also crash the traced applications if unsafe MT access wrangles up some internal data structures.
Unfortunately, this is true.
So the HistoOnEvent example would be correct as the used Swing class is intended to use in a single threaded way, but is unsafe for general use. Therefore I think it would be good to add this information to the javadoc.
Yes, I will try to get some time this week to fix this. Or you can do a PR for this if you feel like it.
Then probably a more general example with @btrace(trusted=true) should be added showing MT-safety can be achieved in a general way.
The same as for the previous point.
I was also looking for general documentation about the MT behavior of the traced code, but this seems to be missing.
Also the mentioned annotation parameters of @btrace are not documented in the Wiki.
Yes, the documenatation is rather sparse :(
I was also looking for the source code in the btrace-client-2.2.-sources.jar, but the JAR does not contain the sources.
As this JARs is downloaded by Maven to provide sources, it would be good if they would be contained.
I will verify this. I was relying on the gradle tasks doing their job but there might be some problem in config.
from btrace.
Stale issue message
from btrace.
Related Issues (20)
- Does the BTrace agent support java 17? HOT 1
- Unsupported class file major version 29281 HOT 5
- Is adding method printStrings with a ... array possible? HOT 4
- Javaagent args for output directory seems wrong HOT 3
- Btrace doesn't trace methods when trusted is true HOT 1
- Adding XStream to the dependencies error HOT 2
- JAR artifacts are shadowed with the version number
- [BTRACE WARN] Class verification failed:
- Windows batch scripts do not work properly HOT 2
- Build fails with missing artifact HOT 4
- NoClassDefFoundError for NonBlockingIdentityHashMap when running an application with BTrace HOT 4
- Review target compileJava15Java in btrace-runtime/build.gradle
- NoClassDefFoundError for ConcurrentAutoTable and others when running an application with BTrace HOT 1
- VerifyError: Bad type on operand stack HOT 2
- The gradle-wrapper.jar is stale with respect to gradle version. HOT 1
- Does the BTrace agent support java 21? HOT 3
- Clarify the versions of java which Btrace can target HOT 2
- help!! btrace issue HOT 9
- BTrace v2.0.2 is unable to enable the unsafe mode HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btrace.