Giter Club home page Giter Club logo

backtrace-java's People

Contributors

bartoszlitwiniuk avatar vlussenburg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backtrace-java's Issues

BacktraceThread hogs cpu on desktop java application

While testing backtrace for my desktop application on mac, I noticed that my app had a huge cpu load while doing nothing. Taking a spindump revealed the issue

I see the BacktraceThread.run endlessly invoking Backtrace.handleBacktraceMessage:
https://github.com/backtrace-labs/backtrace-java/blob/master/src/main/java/backtrace/io/BacktraceThread.java#L55
@OverRide
public void run() {
while (running) {
backtrace.handleBacktraceMessage();
}
this.closing.countDown();
LOGGER.info("BacktraceThread has completed the run method");
}
If there is nothing in the queue, Backtrace.handleBacktraceMessage simply returns immediately:
https://github.com/backtrace-labs/backtrace-java/blob/master/src/main/java/backtrace/io/Backtrace.java#L38
void handleBacktraceMessage() {
try {
if (queue.isEmpty()) {
return;
}
...

Client will fail to send report if attributes contain a null value

This is easily reproduce-able by sending a report with attributes that contain some null value.

java.lang.NullPointerException: null
	at backtrace.io.data.Attributes.splitClientAttributes(Attributes.java:139)
	at backtrace.io.data.Attributes.<init>(Attributes.java:42)
	at backtrace.io.data.BacktraceData.setAttributes(BacktraceData.java:171)
	at backtrace.io.data.BacktraceData.<init>(BacktraceData.java:148)
	at backtrace.io.BacktraceQueueHandler.send(BacktraceQueueHandler.java:33)
	at backtrace.io.BacktraceClient.send(BacktraceClient.java:97)
	at backtrace.io.BacktraceClient.send(BacktraceClient.java:87)

Gson deserialization fails on jdk16+

Starting from jdk16 it's no longer possible to use reflection to access private fields in certain conditions due to strong encapsulation. https://bugs.openjdk.org/browse/JDK-8256358
Backtrace java uses Gson's reflection based type adapter. Hence the failure.

java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.String java.lang.Throwable.detailMessage accessible: module java.base does not "opens java.lang" to unnamed module @63db54ce
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
	at com.google.gson.internal.reflect.UnsafeReflectionAccessor.makeAccessible(UnsafeReflectionAccessor.java:44)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:159)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
	at com.google.gson.Gson.getAdapter(Gson.java:489)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
	at com.google.gson.Gson.getAdapter(Gson.java:489)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
	at com.google.gson.Gson.getAdapter(Gson.java:489)
	at com.google.gson.Gson.toJson(Gson.java:727)
	at com.google.gson.Gson.toJson(Gson.java:714)
	at com.google.gson.Gson.toJson(Gson.java:669)
	at com.google.gson.Gson.toJson(Gson.java:649)
	at backtrace.io.helpers.BacktraceSerializeHelper.toJson(BacktraceSerializeHelper.java:21)
	at backtrace.io.http.ApiSender.sendReport(ApiSender.java:29)
	at backtrace.io.Backtrace.sendReport(Backtrace.java:97)
	at backtrace.io.Backtrace.processSingleBacktraceMessage(Backtrace.java:74)
	at backtrace.io.Backtrace.handleBacktraceMessage(Backtrace.java:47)
	at backtrace.io.BacktraceThread.run(BacktraceThread.java:57)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.