Skip to content
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

[Bug] 中文环境每次调用产生错误,Error starting gRPC call,Request headers must contain only ASCII characters. #865

Open
3 tasks done
my1639963 opened this issue Nov 8, 2024 · 1 comment
Labels
type/bug Something isn't working

Comments

@my1639963
Copy link

my1639963 commented Nov 8, 2024

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Programming Language of the Client

C#

Runtime Platform Environment

OS: Windows11 23H2.22631.4317
Microsoft Visual Studio Community 2022 (64 位) - Current 版本 17.10.3
.net 6

RocketMQ Version of the Client/Server

Server Version 5.3.1
Client 5.1.0

Run or Compiler Version

No response

Describe the Bug

代码片段如下:

            //通过configuration 读取appsettingappsetting.json配置
            var endpoint = confiuration["rocketmq:endpoint"];
            topic = confiuration["rocketmq:topic"];

            var clientConfig = new ClientConfig.Builder()
                .SetEndpoints(endpoint)
                .EnableSsl(false)
                .Build();

                _producer = new Producer.Builder()
                .SetTopics(topic) // 默认主题
                .SetClientConfig(clientConfig)
                .Build()
                .Result;
调用  new Producer.Builder() 时报错 
      An unhandled exception has occurred while executing the request.
      System.AggregateException: One or more errors occurred. (Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: Request headers must contain only ASCII characters.", DebugException="System.Net.Http.HttpRequestException: Request headers must contain only ASCII characters.
         at System.Net.Http.HPack.HPackEncoder.EncodeValueStringPart(String value, Span`1 destination)
         at System.Net.Http.HPack.HPackEncoder.EncodeStringLiteral(String value, Encoding valueEncoding, Span`1 destination, Int32& bytesWritten)
         at System.Net.Http.HPack.HPackEncoder.EncodeStringLiterals(ReadOnlySpan`1 values, String separator, Encoding valueEncoding, Span`1 destination, Int32& bytesWritten)
         at System.Net.Http.HPack.HPackEncoder.EncodeLiteralHeaderFieldWithoutIndexingNewName(String name, ReadOnlySpan`1 values, String separator, Encoding valueEncoding, Span`1 destination, Int32& bytesWritten)
         at System.Net.Http.Http2Connection.WriteLiteralHeader(String name, ReadOnlySpan`1 values, Encoding valueEncoding, ArrayBuffer& headerBuffer)
         at System.Net.Http.Http2Connection.WriteHeaderCollection(HttpRequestMessage request, HttpHeaders headers, ArrayBuffer& headerBuffer)
         at System.Net.Http.Http2Connection.WriteHeaders(HttpRequestMessage request, ArrayBuffer& headerBuffer)
         at System.Net.Http.Http2Connection.SendHeadersAsync(HttpRequestMessage request, CancellationToken cancellationToken, Boolean mustFlush)
         at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
         at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpMessageInvoker.<SendAsync>g__SendAsyncWithTelemetry|6_0(HttpMessageHandler handler, HttpRequestMessage request, CancellationToken cancellationToken)
         at Grpc.Net.Client.Internal.GrpcCall`2.RunCall(HttpRequestMessage request, Nullable`1 timeout)"))
       ---> Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: Request headers must contain only ASCII characters.", DebugException="System.Net.Http.HttpRequestException: Request headers must contain only ASCII characters.
         at System.Net.Http.HPack.HPackEncoder.EncodeValueStringPart(String value, Span`1 destination)
         at System.Net.Http.HPack.HPackEncoder.EncodeStringLiteral(String value, Encoding valueEncoding, Span`1 destination, Int32& bytesWritten)
         at System.Net.Http.HPack.HPackEncoder.EncodeStringLiterals(ReadOnlySpan`1 values, String separator, Encoding valueEncoding, Span`1 destination, Int32& bytesWritten)
         at System.Net.Http.HPack.HPackEncoder.EncodeLiteralHeaderFieldWithoutIndexingNewName(String name, ReadOnlySpan`1 values, String separator, Encoding valueEncoding, Span`1 destination, Int32& bytesWritten)
         at System.Net.Http.Http2Connection.WriteLiteralHeader(String name, ReadOnlySpan`1 values, Encoding valueEncoding, ArrayBuffer& headerBuffer)
         at System.Net.Http.Http2Connection.WriteHeaderCollection(HttpRequestMessage request, HttpHeaders headers, ArrayBuffer& headerBuffer)
         at System.Net.Http.Http2Connection.WriteHeaders(HttpRequestMessage request, ArrayBuffer& headerBuffer)
         at System.Net.Http.Http2Connection.SendHeadersAsync(HttpRequestMessage request, CancellationToken cancellationToken, Boolean mustFlush)
         at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
         at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpMessageInvoker.<SendAsync>g__SendAsyncWithTelemetry|6_0(HttpMessageHandler handler, HttpRequestMessage request, CancellationToken cancellationToken)
         at Grpc.Net.Client.Internal.GrpcCall`2.RunCall(HttpRequestMessage request, Nullable`1 timeout)")
         at Grpc.Net.Client.Internal.GrpcCall`2.GetResponseHeadersCoreAsync()
         at Org.Apache.Rocketmq.ClientLoggerInterceptor.HandleResponse[TResponse](Task`1 t)
         at Org.Apache.Rocketmq.RpcClient.QueryRoute(Metadata metadata, QueryRouteRequest request, TimeSpan timeout)
         at Org.Apache.Rocketmq.ClientManager.QueryRoute(Endpoints endpoints, QueryRouteRequest request, TimeSpan timeout)
         at Org.Apache.Rocketmq.Client.FetchTopicRoute0(String topic)
         at Org.Apache.Rocketmq.Client.FetchTopicRoute(String topic)
         at Org.Apache.Rocketmq.Client.Start()
         at Org.Apache.Rocketmq.Producer.Start()
         at Org.Apache.Rocketmq.Producer.Builder.Build()
         --- End of inner exception stack trace ---

Steps to Reproduce

中文环境windows,每次调用必然触发

What Did You Expect to See?

...

What Did You See Instead?

...

Additional Context

No response

@my1639963 my1639963 added the type/bug Something isn't working label Nov 8, 2024
@my1639963
Copy link
Author

Runtime Data
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant