Spring-cloud-sleuth: websocket demo

Created on 11 Nov 2016  路  19Comments  路  Source: spring-cloud/spring-cloud-sleuth

I am trying the websocket demo, but I received this in the logs when I setup the websocket connection.

2016-11-11 11:58:38.821  WARN [websocket-service,495a092e98c8165d,495a092e98c8165d,false] 89201 --- [nboundChannel-3] o.s.cloud.sleuth.util.ExceptionUtils     : Tried to detach trace span but it is not the current span: [Trace: 495a092e98c8165d, Span: 495a092e98c8165d, Parent: null, exportable:false]. You may have forgotten to close or detach null
2016-11-11 11:58:38.821  WARN [websocket-service,495a092e98c8165d,495a092e98c8165d,false] 89201 --- [nboundChannel-1] o.s.cloud.sleuth.util.ExceptionUtils     : Tried to detach trace span but it is not the current span: [Trace: 495a092e98c8165d, Span: 495a092e98c8165d, Parent: null, exportable:false]. You may have forgotten to close or detach null
2016-11-11 11:58:38.823  WARN [websocket-service,495a092e98c8165d,495a092e98c8165d,false] 89201 --- [nboundChannel-2] o.s.cloud.sleuth.util.ExceptionUtils     : Tried to detach trace span but it is not the current span: [Trace: 495a092e98c8165d, Span: 495a092e98c8165d, Parent: null, exportable:false]. You may have forgotten to close or detach null
2016-11-11 11:58:38.825  WARN [websocket-service,495a092e98c8165d,a20dcf2c170aa53e,false] 89201 --- [tboundChannel-1] o.s.cloud.sleuth.util.ExceptionUtils     : Tried to detach trace span but it is not the current span: [Trace: 495a092e98c8165d, Span: a20dcf2c170aa53e, Parent: 495a092e98c8165d, exportable:false]. You may have forgotten to close or detach null
2016-11-11 11:58:38.832  WARN [websocket-service,37e0966f0f3c3a65,37e0966f0f3c3a65,false] 89201 --- [nboundChannel-4] o.s.cloud.sleuth.util.ExceptionUtils     : Tried to detach trace span but it is not the current span: [Trace: 37e0966f0f3c3a65, Span: 37e0966f0f3c3a65, Parent: null, exportable:false]. You may have forgotten to close or detach null
2016-11-11 11:58:38.833  WARN [websocket-service,37e0966f0f3c3a65,37e0966f0f3c3a65,false] 89201 --- [nboundChannel-6] o.s.cloud.sleuth.util.ExceptionUtils     : Tried to detach trace span but it is not the current span: [Trace: 37e0966f0f3c3a65, Span: 37e0966f0f3c3a65, Parent: null, exportable:false]. You may have forgotten to close or detach null
2016-11-11 11:58:38.834  WARN [websocket-service,37e0966f0f3c3a65,37e0966f0f3c3a65,false] 89201 --- [nboundChannel-5] o.s.cloud.sleuth.util.ExceptionUtils     : Tried to detach trace span but it is not the current span: [Trace: 37e0966f0f3c3a65, Span: 37e0966f0f3c3a65, Parent: null, exportable:false]. You may have forgotten to close or detach null

Here is my example application:

https://github.com/altfatterz/websocket-demo

This also happens with the 1.2.0.BUILD-SNAPSHOT

bug

Most helpful comment

You can set the spring.sleuth.integration.websockets.enabled to false. That way you'll disable Sleuth for websockets.

All 19 comments

That's unfortunate :/ Thanks for the sample - I'll check it out ASAP

Here's the problem: TraceChannelInterceptor.afterMessageHandled() calls Tracer.detach()
which unconditionally removes the current span, but it's already running in a SpanContinuingTraceRunnable so the runnable wrapper tries to detach it as well when the delegate completes. I'm not sure how to fix this, but it seems like it will be a recurring problem for messaging apps when the message is sent asynchronously.

Also maybe relevant: 8d48406.

Is there a work-around?
Can you disable sleuth for websocket communication?
We use spring-websocket backed up by RabbitMQ and each heartbeat causes this warning in the logs.

You can set the spring.sleuth.integration.websockets.enabled to false. That way you'll disable Sleuth for websockets.

So I assume that it worked fine? :P

Yes it did. Thx

@altfatterz I've checked your code and it seemed to work ok but it would be great if you could double check it :)

Hi
So, this was resolved with the 1.0.12 ? thank you

Yeah it seems so

hi guys,
I am facing the same issue
2017-07-03 10:40:26.410 WARN [wiretap,,,] 6288 --- [nio-9411-exec-9] o.s.cloud.sleuth.util.ExceptionUtils : Tried to close span but it is not the current span: [Trace: 0624ac6ca8f8baec, Span: 0624ac6ca8f8baec, Parent: null, exportable:true]. You may have forgotten to close or detach [Trace: 0624ac6ca8f8baec, Span: 8a28ceabfa2be8ca, Parent: 0624ac6ca8f8baec, exportable:true]

But cannot resolve it....kindly help

Which version of Sleuth are you using?

buildscript {
    ext {
        springBootVersion = '1.4.2.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

jar {
    baseName = 'pep'
    version = ''
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-actuator')
    compile('org.springframework.cloud:spring-cloud-starter-sleuth')
    compile('org.springframework.cloud:spring-cloud-starter-stream-rabbit')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.cloud:spring-cloud-sleuth-zipkin')
    compile('io.zipkin.java:zipkin-autoconfigure-ui')
    compile('org.springframework.cloud:spring-cloud-starter-sleuth')
    compile('org.webjars:bootstrap')
    compile('org.springframework.boot:spring-boot-starter-tomcat')
    compile('io.zipkin.reporter:zipkin-sender-urlconnection')
    compile "org.springframework.boot:spring-boot-starter-web"
    compile "io.zipkin.java:zipkin-autoconfigure-ui:1.0.0"
    compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit"
    compile "io.zipkin.java:zipkin-server"




    testCompile('org.springframework.boot:spring-boot-starter-test')

}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.SR3"
    }
}

This is my gradle properties file.

Camden.SR3 is ancient. Please use latest versions of the release train.

I m very begginer in this so kindly tell me which version should i use

Please check out this site - http://projects.spring.io/spring-cloud/ . To the right, you have a list of release trains. The latest release train is Dalston.SR1 (it has the label current next to it). In order to use that you have to bump Boot to 1.5.x.

Hi
I modified as per changes in gradle.build (added dependencies, change dependency manager, updated springBootVersion to 1.5) still i'm facing issue as below :

Could not resolve all dependencies for configuration 'detachedConfiguration5'.

Could not find :spring-cloud-starter-config:.
Searched in the following locations:
https://repo1.maven.org/maven2//spring-cloud-starter-config//spring-cloud-starter-config-.pom
https://repo1.maven.org/maven2//spring-cloud-starter-config//spring-cloud-starter-config-.jar
Required by:
project :
Could not find :spring-cloud-starter-eureka:.
Searched in the following locations:
https://repo1.maven.org/maven2//spring-cloud-starter-eureka//spring-cloud-starter-eureka-.pom
https://repo1.maven.org/maven2//spring-cloud-starter-eureka//spring-cloud-starter-eureka-.jar
Required by:
project :

I don't know how your configuration looks like so I can't help you much. Also it's not a Sleuth issue. Please go to http://start.spring.io/ and regenerate the project with proper dependencies. That will be the quickest solution.

thanks @marcingrzejszczak .....I had done zipkin integration on demo app using http://start.spring.io/ and was trying to do this with an complex app.But thanks for the support Cheers!!!!

Was this page helpful?
0 / 5 - 0 ratings