Git Product home page Git Product logo

Comments (5)

mwunderl avatar mwunderl commented on August 15, 2024 2

I've added some information about multithreading to the developer guide-
Using Instrumented Clients in Worker Threads
Passing Segment Context between Threads in a Multithreaded Application

from eb-java-scorekeep.

mwunderl avatar mwunderl commented on August 15, 2024

Hi Paolo,
Thanks for your feedback. Do you see anything in the SDK log when you try to record an exception with this code?
-Michael

from eb-java-scorekeep.

paolocarrasco avatar paolocarrasco commented on August 15, 2024

Yes, this is one of the errors we get:

2017-09-04 11:35:23,269 ERROR [autenticacion-Executor-1] ExceptionHandlingAsyncTaskExecutor: Caught async exception
com.amazonaws.xray.exceptions.SegmentNotFoundException: Thread has no segment in progress.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.amazonaws.xray.strategy.RuntimeErrorContextMissingStrategy.contextMissing(RuntimeErrorContextMissingStrategy.java:17)
at com.amazonaws.xray.AWSXRayRecorder.getCurrentSubsegment(AWSXRayRecorder.java:477)
at com.amazonaws.xray.AWSXRay.getCurrentSubsegment(AWSXRay.java:116)
at pe.com.foobar.mobileservices.appmovil.config.XRayAspect.afterThrowing(XRayAspect.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:611)
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656)
at pe.com.foobar.mobileservices.appmovil.repository.impl.PortalAppsRepositoryImpl$$EnhancerBySpringCGLIB$$f13c6b6d.insertActionCode(<generated>)
at pe.com.foobar.mobileservices.appmovil.dao.impl.ActionCodeDaoImpl.executeInsertActionCode(ActionCodeDaoImpl.java:52)
at pe.com.foobar.mobileservices.appmovil.dao.impl.ActionCodeDaoImpl.lambda$insertActionCode$1(ActionCodeDaoImpl.java:40)
at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

On errors we are using RuntimeExceptions, which create different threads, and I think the segment is being bound to the main thread... (thinking aloud).

from eb-java-scorekeep.

mwunderl avatar mwunderl commented on August 15, 2024

When you create a new thread, you need to pass the open segment or subsegment to the new thread manually. Use GetTraceEntity to get the segment or subsegment Entity, pass it to the new thread, and then hand it back to the SDK with SetTraceEntity.

from eb-java-scorekeep.

paolocarrasco avatar paolocarrasco commented on August 15, 2024

Hi @mwunderl, thanks!
I finally found that the best approach to register the exceptions is by using an around aspect; before and after are useful only on annotations and metadata.

from eb-java-scorekeep.

Related Issues (8)

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.