-
Notifications
You must be signed in to change notification settings - Fork 893
EC2 DescribeInstances
query uses locale-dependent formatting
#5968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
bug
This issue is a bug.
needs-review
This issue or PR needs review from the team.
p2
This is a standard priority issue
Comments
DaveCTurner
added a commit
to DaveCTurner/elasticsearch
that referenced
this issue
Mar 18, 2025
A SDK bug[1] means that these values sometimes don't parse as an integer. We don't need them to do so in order to pass the test, so this commit relaxes the test to accept any string. [1]: aws/aws-sdk-java-v2#5968
DaveCTurner
added a commit
to DaveCTurner/elasticsearch
that referenced
this issue
Mar 18, 2025
A SDK bug[^1] means that these values sometimes don't parse as an integer. We don't need them to do so in order to pass the test, so this commit relaxes the test to accept any string. [^1]: aws/aws-sdk-java-v2#5968
elasticsearchmachine
pushed a commit
to elastic/elasticsearch
that referenced
this issue
Mar 19, 2025
A SDK bug[^1] means that these values sometimes don't parse as an integer. We don't need them to do so in order to pass the test, so this commit relaxes the test to accept any string. Closes #125090 Closes #125166 [^1]: aws/aws-sdk-java-v2#5968
DaveCTurner
added a commit
to elastic/elasticsearch
that referenced
this issue
Mar 19, 2025
A SDK bug[^1] means that these values sometimes don't parse as an integer. We don't need them to do so in order to pass the test, so this commit relaxes the test to accept any string. Closes #125090 Closes #125166 [^1]: aws/aws-sdk-java-v2#5968
smalyshev
pushed a commit
to smalyshev/elasticsearch
that referenced
this issue
Mar 21, 2025
A SDK bug[^1] means that these values sometimes don't parse as an integer. We don't need them to do so in order to pass the test, so this commit relaxes the test to accept any string. Closes elastic#125090 Closes elastic#125166 [^1]: aws/aws-sdk-java-v2#5968
omricohenn
pushed a commit
to omricohenn/elasticsearch
that referenced
this issue
Mar 28, 2025
A SDK bug[^1] means that these values sometimes don't parse as an integer. We don't need them to do so in order to pass the test, so this commit relaxes the test to accept any string. Closes elastic#125090 Closes elastic#125166 [^1]: aws/aws-sdk-java-v2#5968
ldematte
added a commit
to elastic/elasticsearch
that referenced
this issue
Apr 15, 2025
AWS SDK v2 has a bug (aws/aws-sdk-java-v2#5968) where PathResolver uses locale-dependent formatting. This PR adds a patcher to the discovery-ec2 build process to replace calls to String.format(<format>, <args>) with String.format(Locale.ROOT, <format>, <args>). Relates to ES-11279
afoucret
pushed a commit
to afoucret/elasticsearch
that referenced
this issue
Apr 16, 2025
AWS SDK v2 has a bug (aws/aws-sdk-java-v2#5968) where PathResolver uses locale-dependent formatting. This PR adds a patcher to the discovery-ec2 build process to replace calls to String.format(<format>, <args>) with String.format(Locale.ROOT, <format>, <args>). Relates to ES-11279
Hello @DaveCTurner, Thanks for reporting the issue. We'll look into this. Below is the minimal reproducible code sample: package org.example;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.ec2.Ec2Client;
import software.amazon.awssdk.services.ec2.model.DescribeInstancesRequest;
import software.amazon.awssdk.services.ec2.model.Filter;
import java.util.Locale;
public class Main {
public static void main(String[] args) {
Locale currentLocale = Locale.getDefault();
System.out.println("Current Default Locale: " + currentLocale);
System.out.println("Setting the Default Locale to Nepalese (ne)...");
Locale.setDefault(new Locale("ne"));
Locale newLocale = Locale.getDefault();
System.out.println("New Default Locale: " + newLocale);
Ec2Client ec2Client = Ec2Client.builder()
.region(Region.US_EAST_1)
.build();
DescribeInstancesRequest request = DescribeInstancesRequest.builder()
.filters(
Filter.builder().name("instance-state-name").values("running", "pending").build(),
Filter.builder().name("tag:stage").values("prod").build()
)
.build();
ec2Client.describeInstances(request);
}
} Debug log:
Regards, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
This issue is a bug.
needs-review
This issue or PR needs review from the team.
p2
This is a standard priority issue
Describe the bug
When calling
Ec2Client#describeInstances
with one or more filter expressions, the filters contain numbers formatted using the current locale rather than the root locale. Thus for instance running in thene
(Nepalese) local the query usesFilter.%E0%A5%A7.Name
rather thanFilter.1.Name
, where%E0%A5%A7
is the UTF-8 encoding forU+0967 DEVANAGARI DIGIT ONE
which is the rendering for the integer1
in this locale. The full HTTP request in this case is as follows:EC2 rejects this with a
400 Bad request
:The problem is that
software.amazon.awssdk.protocols.query.internal.marshall.ListQueryMarshaller#EC2_QUERY_PATH_RESOLVER
uses a bareString.format("%s.%d", path, i + 1)
rather thanString.format(Locale.ROOT, "%s.%d", path, i + 1)
Regression Issue
Expected Behavior
In all locales, we should render the filters using ASCII digits
0
to9
only:Current Behavior
We render the filters using locale-dependent numerals, UTF-8-encoded, for instance in the
ne
locale:Reproduction Steps
Attempt to invoke
Ec2Client#describeInstances
in a locale that does not render numerals using the ASCII digits0
to9
, such as for instancene
.Possible Solution
Additional Information/Context
No response
AWS Java SDK version used
2.30.38
JDK version used
OpenJDK Runtime Environment Temurin-23+37 (build 23+37)
Operating System and version
Mac OS X 15.3.2 aarch64/Oracle Corporation 23 (64-bit)/cpus=12,threads=1,free=493903224,total=536870912
The text was updated successfully, but these errors were encountered: