openzipkin / zipkin-aws

Reporters and collectors for use in Amazon's cloud
Apache License 2.0
69 stars 34 forks source link

NullPointers in aws-java-sdk-core in s3 clients #147

Open wavetylor opened 4 years ago

wavetylor commented 4 years ago

The TracingRequestHandler in brave-instrumentation/aws-java-sdk-core can throw NPE due to an application span not being present in both the beforeAttempt and afterAttempt callback.

The root cause here is the s3 client executes a stealth HEAD request for many of the operations like CreateBucket, doesBucketExistV2 to do some preliminary checking and caching. Unfortunately, these HEAD requests do not invoke beforeExecution so an application span is never created for them, but they do invoke beforeAttempt.

This means the overall aws-sdk span isn't available and results in the NPE.

A couple of options: