Comments (2)
Thank you for sharing this with us!
Unfortunately I cannot start your application:
- Even if you marked it with a
@Primary
in theLocalStackConfiguration
, the other bean is still created and it fails with this error:
Caused by: com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.
at com.amazonaws.client.builder.AwsClientBuilder.setRegion(AwsClientBuilder.java:462) ~[aws-java-sdk-core-1.12.266.jar:na]
at com.amazonaws.client.builder.AwsClientBuilder.configureMutableProperties(AwsClientBuilder.java:424) ~[aws-java-sdk-core-1.12.266.jar:na]
at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46) ~[aws-java-sdk-core-1.12.266.jar:na]
at com.example.lockbug.DynamoDbLockBugConfiguration.amazonDynamoDB(DynamoDbLockBugConfiguration.java:40) ~[main/:na]
- When I remove that bean in the
DynamoDbLockBugConfiguration
, I fail with this error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'amazonS3': Invocation of init method failed; nested exception is com.amazonaws.SdkClientException: Unable to load region information from any provider in the chain
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.24.jar:5.3.24]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.24.jar:5.3.24]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.24.jar:5.3.24]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.24.jar:5.3.24]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.24.jar:5.3.24]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.24.jar:5.3.24]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.24.jar:5.3.24]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:936) ~[spring-beans-5.3.24.jar:5.3.24]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.24.jar:5.3.24]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.24.jar:5.3.24]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.7.jar:2.7.7]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.7.jar:2.7.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.7.jar:2.7.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.7.jar:2.7.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.7.jar:2.7.7]
at com.example.lockbug.LockBugApplication.main(LockBugApplication.java:10) ~[main/:na]
Caused by: com.amazonaws.SdkClientException: Unable to load region information from any provider in the chain
at com.amazonaws.regions.AwsRegionProviderChain.getRegion(AwsRegionProviderChain.java:59) ~[aws-java-sdk-core-1.12.266.jar:na]
at io.awspring.cloud.core.region.DefaultAwsRegionProviderChainDelegate.getRegion(DefaultAwsRegionProviderChainDelegate.java:37) ~[spring-cloud-aws-core-2.4.2.jar:2.4.2]
at io.awspring.cloud.core.config.AmazonWebserviceClientFactoryBean.createInstance(AmazonWebserviceClientFactoryBean.java:130) ~[spring-cloud-aws-core-2.4.2.jar:2.4.2]
at io.awspring.cloud.core.config.AmazonWebserviceClientFactoryBean.createInstance(AmazonWebserviceClientFactoryBean.java:52) ~[spring-cloud-aws-core-2.4.2.jar:2.4.2]
at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:142) ~[spring-beans-5.3.24.jar:5.3.24]
Apparently some other AWS services are trying to be auto-configured and you probably have some AWS SDK configuration locally in the ~/.aws/credentials
.
Anyway I have a code from you so I'll try to reproduce it and play with from JUnit test where I use Testcontainers for LocalStack instead.
Will come back with some finding a bit later...
from spring-integration-aws.
OK. So, I see (or at least guess) what is going on.
This logic in the AmazonDynamoDBLockClient
has no sense:
if (options.shouldSkipBlockingWait() && existingLock.isPresent() && !existingLock.get().isExpired()) {
That isExpired()
is always true
:
return LockClientUtils.INSTANCE.millisecondTime() - this.lookupTime.get() > this.leaseDuration.get();
where that this.lookupTime
is set exactly as a LockClientUtils.INSTANCE.millisecondTime()
in the getLockFromDynamoDB(getLockOptions)
method call from the beginning of the while (true)
loop in the acquireLock()
.
So, no matter how much we try to wait in between lock.tryLock()
, that isExpired()
is always false
when we do shouldSkipBlockingWait()
.
I will try to find some workaround (at least restore the previous behavior), but it feel like a bug in the DynamoDB Lock Client library by itself.
There is no reasonable lookupTime
to make an item to expire in time for our call when we don't want to wait.
And therefore we end up with an impression that it never expires. 🤷
from spring-integration-aws.
Related Issues (20)
- Unclear dependency requirements for the S3 code examples HOT 2
- KinesisMessageDrivenChannelAdapter repeating TimeoutException on 2nd instance when shard is closed and exhauted HOT 5
- Add payload conversion to SQS listener HOT 1
- Documentation: How to configure SnsMessageHandler HOT 3
- WARN logs in default configuration HOT 6
- SNSMessageHandle shows incorrect logs and error message
- spring-cloud-aws v3 support HOT 1
- KinesisMessageDrivenChannelAdapter crashes if first batch of a data stream never checkpoints (manual checkpoint, batch listenerMode) HOT 16
- Allow configuration of TaskExecutor in KclMessageDrivenChannelAdapter HOT 8
- KinesisMessageDrivenChannelAdapter can't recover after system sleep HOT 36
- EL1008E: Property or field 'SnsBodyBuilder' cannot be found HOT 1
- SNS MessageAttributes propagation to SQS in case raw message delivery is disabled HOT 9
- ClassNotFoundException when using S3MessageHandler HOT 1
- DynamoDbLock - Missing the key sortKey in the item HOT 1
- Set a Failure channel for SqsMessageHandler HOT 1
- Spring Integration 3.0.1 doesnt support KCL2 with Enhanced Fanout
- Spring Integration KCL2 only support Fanout Consumer. Should also support Shared Consumer HOT 1
- KCL2 standard consumer registering as Fanout Consumer HOT 3
- Kinesis last checkpoint and shard iterator are Strings, but are parsed as BigIntegers and fail with NumberFormatException HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-integration-aws.