Could not refresh secret manager Got error Cannot begin a subsegment without an initialized segment when password changed
totten25 opened this issue · 2 comments
I'm getting an error --> Cannot begin a subsegment without an initialized segment
when a password has been changed and secret manager lib detects an error after requesting a new connection,
and it calls SecretCacheItem.executeRefresh
protected DescribeSecretResult executeRefresh() {
DescribeSecretResult describeSecretResult = client.describeSecret(
updateUserAgent(new DescribeSecretRequest()
.withSecretId(this.secretId)));
long ttl = this.config.getCacheItemTTL();
this.nextRefreshTime = System.currentTimeMillis() +
ThreadLocalRandom.current().nextLong(ttl / 2,ttl + 1) ;
return describeSecretResult;
}
I configure AWS X-ray and it's failed when getting TraceEntity
public Subsegment beginSubsegment(String name) {
Entity traceEntity = this.getTraceEntity();
if (traceEntity == null) {
throw new IllegalStateException("Cannot begin a subsegment without an initialized segment");
} else {
return super.beginSubsegment(name);
}
}
To Reproduce
You may try to add AWS X-ray into Java Project and try to execute refreshNow method
Expected behavior
Secret Manager should be refreshed with new value from Secret Manager
Environment:
OS: Windows 10
Java: 1.8
AWS SDK: 1.11.446
Additional context
You can check more detail from the attachment which is stacktrace.
Thank you for opening this issue -- the AWS X-Ray SDK is not bundled with the AWS Secrets Manager JDBC driver and the Cannot begin a subsegment without an initialized segment
error message originates from the AWS X-Ray SDK. Can you share more information about how the AWS X-Ray SDK is being configured and initialized on your application? Documentation on how to configure the AWS X-Ray SDK can be found here and on the AWS X-Ray SDK GitHub here.
If there is another error message related to the Secrets Manager JDBC driver, please share that here as well.
Closing this due to no additional details from customer -- please open an new issue if help is needed in future.