DataDog / dd-trace-java

Datadog APM client for Java
https://docs.datadoghq.com/tracing/languages/java
Apache License 2.0
588 stars 290 forks source link

java.lang.NullPointerException: Cannot invoke "datadog.trace.bootstrap.instrumentation.api.AgentSpan.setTag(String, java.lang.CharSequence)" because "span" is null #7773

Closed jmayday closed 1 month ago

jmayday commented 1 month ago

I've seen https://github.com/DataDog/dd-trace-java/issues/5185 and https://github.com/DataDog/dd-trace-java/issues/5186 being closed already, but I'm having same issue with DD java agent 1.38.0:

Stacktrace:

java.lang.NullPointerException: Cannot invoke "datadog.trace.bootstrap.instrumentation.api.AgentSpan.setTag(String, java.lang.CharSequence)" because "span" is null
    at datadog.trace.bootstrap.instrumentation.decorator.http.HttpResourceDecorator.withRoute(HttpResourceDecorator.java:45)
    at datadog.trace.instrumentation.vertx_3_4.server.EndHandlerWrapper.handle(EndHandlerWrapper.java:33)
    at datadog.trace.instrumentation.vertx_3_4.server.EndHandlerWrapper.handle(EndHandlerWrapper.java:13)
    at io.vertx.core.http.impl.HttpServerResponseImpl.end(HttpServerResponseImpl.java:396)
    at io.vertx.core.http.impl.HttpServerResponseImpl.end(HttpServerResponseImpl.java:365)
    at io.vertx.core.http.impl.HttpServerResponseImpl.end(HttpServerResponseImpl.java:345)
    at io.vertx.reactivex.core.http.HttpServerResponse.end(HttpServerResponse.java:417)

Tracer configuration:

{
    "version": "1.38.0~60ddc9e0d7",
    "os_name": "Linux",
    "os_version": "5.10.226-214.879.amzn2.x86_64",
    "architecture": "amd64",
    "lang": "jvm",
    "lang_version": "17.0.10",
    "jvm_vendor": "Eclipse Adoptium",
    "jvm_version": "17.0.10+7",
    "java_class_version": "61.0",
    "http_nonProxyHosts": "null",
    "http_proxyHost": "null",
    "enabled": true,
    "service": "myServiceName",
    "agent_url": "http://localhost:8126",
    "agent_error": false,
    "debug": false,
    "trace_propagation_style_extract": [
        "datadog",
        "tracecontext"
    ],
    "trace_propagation_style_inject": [
        "datadog",
        "tracecontext"
    ],
    "analytics_enabled": false,
    "priority_sampling_enabled": true,
    "logs_correlation_enabled": true,
    "profiling_enabled": false,
    "remote_config_enabled": true,
    "debugger_enabled": false,
    "debugger_exception_enabled": false,
    "appsec_enabled": "ENABLED_INACTIVE",
    "rasp_enabled": false,
    "telemetry_enabled": true,
    "telemetry_dependency_collection_enabled": true,
    "telemetry_log_collection_enabled": false,
    "dd_version": "3c4ca42",
    "health_checks_enabled": true,
    "configuration_file": "no config file present",
    "runtime_id": "1ee42b2b-29fb-4a2d-b639-698c1fc393a5",
    "logging_settings": {
        "levelInBrackets": false,
        "dateTimeFormat": "'[dd.trace 'yyyy-MM-dd HH:mm:ss:SSS Z']'",
        "logFile": "System.err",
        "configurationFile": "simplelogger.properties",
        "showShortLogName": false,
        "showDateTime": true,
        "showLogName": true,
        "showThreadName": true,
        "defaultLogLevel": "INFO",
        "warnLevelString": "WARN",
        "embedException": false
    },
    "cws_enabled": false,
    "cws_tls_refresh": 5000,
    "datadog_profiler_enabled": false,
    "datadog_profiler_safe": true,
    "datadog_profiler_enabled_overridden": false,
    "data_streams_enabled": false
}
amarziali commented 1 month ago

Thanks for having opened (again) one issue. I just merged a fix that should hopefully avoid this specific situation. It will be released with the next minor (1.41.0)

github-actions[bot] commented 1 month ago

:robot: This issue has been addressed in the latest release. Check full details in the Release Notes.