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

[QUERY] Getting the following error from eventhub : Operation is not valid due to the current state of the object #21025

Closed
digeler opened this issue May 12, 2021 · 1 comment
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs

Comments

@digeler
Copy link

digeler commented May 12, 2021

Hi Team , we started to get the following exception when try to read from event hub :

2021-05-12 16:24:42.4493 Info EventHubClientFactory LogConnectionString got connection string for namespace [namespace=testdgeuse1inputeh]
2021-05-12 16:24:42.4503 Info ReadEventHubDataCmdlet RunAsync starting To Read
2021-05-12 16:24:42.9097 Error ReadEventHubDataCmdlet ProcessRecord System.InvalidOperationException: Operation is not valid due to the current state of the object.
at void Microsoft.Azure.Amqp.Transport.TransportStream.Flush()
at Task System.IO.Stream.FlushAsync(CancellationToken cancellationToken)+(object state) => { }
at void System.Threading.Tasks.Task.s_ecCallback(object obj)
at void System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, object state)
at void System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, object state)
at async Task System.Net.Security.SslStream.ForceAuthenticationAsync(TIOAdapter adapter, bool receiveFirst, byte[] reAuthenticationData, bool isApm)
at void System.Threading.Tasks.TaskToApm.End(IAsyncResult asyncResult)
at void System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
at void Microsoft.Azure.Amqp.Transport.TlsTransport.HandleOpenComplete(IAsyncResult result, bool syncComplete)
at void Microsoft.Azure.Amqp.ExceptionDispatcher.Throw(Exception exception)
at TAsyncResult Microsoft.Azure.Amqp.AsyncResult.End(IAsyncResult result)
at void Microsoft.Azure.Amqp.AmqpObject+OpenAsyncResult.End(IAsyncResult result)
at void Microsoft.Azure.Amqp.AmqpObject.EndOpen(IAsyncResult result)
at void Microsoft.Azure.Amqp.Transport.TlsTransportInitiator.HandleTransportOpened(IAsyncResult result)
at void Microsoft.Azure.Amqp.Transport.TlsTransportInitiator.OnTransportOpened(IAsyncResult result)
at async Task Azure.Messaging.EventHubs.Amqp.AmqpConnectionScope.CreateAndOpenConnectionAsync(Version amqpVersion, Uri serviceEndpoint, EventHubsTransportType transportType, IWebProxy proxy, string scopeIdentifier, TimeSpan timeout)
at async Task Microsoft.Azure.Amqp.FaultTolerantAmqpObject.OnCreateAsync(TimeSpan timeout)
at async Task Microsoft.Azure.Amqp.Singleton.GetOrCreateAsync(TimeSpan timeout)
at async Task Microsoft.Azure.Amqp.Singleton.GetOrCreateAsync(TimeSpan timeout)
at async Task Azure.Messaging.EventHubs.Amqp.AmqpConnectionScope.OpenManagementLinkAsync(TimeSpan timeout, CancellationToken cancellationToken)
at async Task Microsoft.Azure.Amqp.FaultTolerantAmqpObject.OnCreateAsync(TimeSpan timeout)
at async Task Microsoft.Azure.Amqp.Singleton.GetOrCreateAsync(TimeSpan timeout)
at async Task Microsoft.Azure.Amqp.Singleton.GetOrCreateAsync(TimeSpan timeout)
at async Task Azure.Messaging.EventHubs.Amqp.AmqpClient.GetPropertiesAsync(EventHubsRetryPolicy retryPolicy, CancellationToken cancellationToken)
at async Task Azure.Messaging.EventHubs.Amqp.AmqpClient.GetPropertiesAsync(EventHubsRetryPolicy retryPolicy, CancellationToken cancellationToken)
at async Task Azure.Messaging.EventHubs.EventHubConnection.GetPropertiesAsync(EventHubsRetryPolicy retryPolicy, CancellationToken cancellationToken)
at async Task<string[]> Azure.Messaging.EventHubs.EventHubConnection.GetPartitionIdsAsync(EventHubsRetryPolicy retryPolicy, CancellationToken cancellationToken)
at async Task<string[]> Azure.Messaging.EventHubs.Consumer.EventHubConsumerClient.GetPartitionIdsAsync(CancellationToken cancellationToken)
at void Microsoft.test.Tools.EventHubConsumerClientExtension+<>c__DisplayClass1_0+<b__1>d.MoveNext() in C:/repos/oom-alerts-prom/test-testgon/src/Tools/Extensions/EventHubConsumerClientExtension.cs:line 48
at async Task<IReadOnlyCollection> Microsoft.test.Infrastructure.EnumerableExtension.SelectManyAsync<TSourceItem, TDestinationResult>(IEnumerable enumerable, Func<TSourceItem, Task<IEnumerable>> selectorAsync) in C:/repos/oom-alerts-prom/test-testgon/src/Infrastructure/Extensions/EnumerableExtension.cs:line 274
at async IAsyncEnumerable Microsoft.test.Tools.EventHubConsumerClientExtension.ReadEventsUntilEmptyAsync(IReadOnlyCollection eventHubClients, EventPosition eventPosition, ReadEventOptions readEventOptions, CancellationToken cancellationToken) in C:/repos/oom-alerts-prom/test-testgon/src/Tools/Extensions/EventHubConsumerClientExtension.cs:line 44
at async IAsyncEnumerable Microsoft.test.Tools.EventHubConsumerClientExtension.ReadEventsUntilEmptyAsync(IReadOnlyCollection eventHubClients, EventPosition eventPosition, ReadEventOptions readEventOptions, CancellationToken cancellationToken)
at TResult System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable+ConfiguredValueTaskAwaiter.GetResult()
at async ValueTask System.Linq.AsyncEnumerable+SelectEnumerableAsyncIterator<TSource, TResult>.MoveNextCore() in //Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs:line 199
at TResult System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable+ConfiguredValueTaskAwaiter.GetResult()
at async ValueTask System.Linq.AsyncIteratorBase.MoveNextAsync() in /
/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70
at async ValueTask System.Linq.AsyncIteratorBase.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75
at TResult System.Runtime.CompilerServices.ValueTaskAwaiter.GetResult()
at async Task Microsoft.test.Tools.ReadEventHubDataCmdlet.RunAsync() in C:/repos/oom-alerts-prom/test-testgon/src/Tools/Cmdlets/ClusterCmdlets/WorkerClusterCmdlets/ReadEventHubDataCmdlet.cs:line 145
at async Task Microsoft.test.Tools.ReadEventHubDataCmdlet.RunAsync() in C:/repos/oom-alerts-prom/test-testgon/src/Tools/Cmdlets/ClusterCmdlets/WorkerClusterCmdlets/ReadEventHubDataCmdlet.cs:line 145
at void Microsoft.test.Infrastructure.TaskExtension.Await(Task task) in C:/repos/oom-alerts-prom/test-testgon/src/Infrastructure/Extensions/TaskExtension.cs:line 20
at void Microsoft.test.Tools.ExtendedCmdlet.ProcessRecord() in C:/repos/oom-alerts-prom/test-testgon/src/Tools/Cmdlets/ExtendedCmdlet.cs:line 86
Read-testEventHubData: Operation is not valid due to the current state of the object.

We are using .netcore 3.1 I have seen a lot of issues in Gh regarding .net 5 but its not our case.

This is where the execption is thrown :
image
thanks

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label May 12, 2021
@jsquire
Copy link
Member

jsquire commented May 12, 2021

This was resolved via internal mail thread; the underlying cause was most likely a transient network issue that caused the AMQP library to encounter an unexpected state. The v5.4.1 release of the Event Hubs SDK was enhanced with additional handling for special cases of InvalidOperationException encountered when AMQP connections/links are created.

@digeler was able to update and confirmed that moving to the newer SDK version resolved the issue. I'm going to close this out, but please feel free to reopen if you believe further discussion is needed.

@jsquire jsquire closed this as completed May 12, 2021
@jsquire jsquire self-assigned this May 12, 2021
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. Event Hubs labels May 12, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label May 12, 2021
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-net that referenced this issue Oct 6, 2022
Sasolank/more review comments (Azure#21025)

* XML

* proxy to gateway
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-net that referenced this issue Oct 14, 2022
[2022-04-01-preview] Add New Api-version for Microsoft.ApiManagement (Azure#20399)

* Adds base for updating Microsoft.ApiManagement from version preview/2021-12-01-preview to version 2022-04-01-preview

* Updates readme

* Updates API version in new specs and examples

* APIM Auth Servers (Azure#19234)

* APIM Auth Servers

* adding x-ms-identifiers

* removing some weird, invisible special char

* formatting

* oAuth2AuthenticationSettings moved to AuthSettings

* Formatting

Co-authored-by: Milan Zolota <mizolota@microsoft.com>

* API Management Authorization Endpoints (Azure#19615)

* Add blockchain to latest profile

* Add additional types

* add authorizations definitions

* authorizations operations

* add examples

* update readme

* fix examples

* fix linter delete errors

* address CI validation errors

* prettier fix

* update to 2022-04

* fix readme

* Update specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-04-01-preview/apimauthorizationproviders.json

Co-authored-by: Sean Kim <seaki@microsoft.com>

* update versions

* Apply suggestions from code review

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Co-authored-by: Annaji Sharma Ganti <anganti@microsoft.com>
Co-authored-by: Annaji Sharma Ganti <42851022+annaji-msft@users.noreply.github.com>

* Move Long running Create Operation from Location based to Azure-AsyncOperation Header (Azure#19733)

* azure-asyncOperation

* prettier

* fix(apim): Add missing 'metrics' property to diagnostics contract in 2022-04-01-preview (Azure#20317)

* apim /PUT apis import add translateRequiredQueryParameters (Azure#20333)

* [2022-04-01-preview] Replace resource with proxyresource and TrackedResource (Azure#20461)

* replace resource with proxyresource

* revert to proxyresource

* Add type object to authorization definitions (Azure#20631)

Authorization definitions were missing "type": "object", and this change adds that key/value pair

* Add type object to policy fragment definition (Azure#20585)

* APIM Open ID Connect providers (Azure#20622)

* APIM Open ID Connect providers

* added new proeprties for update

* prettier

* [APIM] Add Nat Gateway (Azure#19990)

* Update apimdeployment.json

* Create ApiManagementCreateServiceWithNatGatewayEnabled.json

* fix typo in file

* Change Nat Gateway property to enum

* modify type of natgateway state

* update property name

* add example reference

* small fix in example

* rename to  outboundPublicIPAddresses

Co-authored-by: Samir Solanki <samirsolanki@outlook.com>

* [2022-04-01-preview] MIgrate2Stv2 API (Azure#20504)

* migrate2stv2

* updated to post

* 202 and location

* add body to 202

* remove body from 202

Co-authored-by: Vatsa Patel <vatsapatel@microsoft.com>
Co-authored-by: Samir Solanki <samirsolanki@outlook.com>
Co-authored-by: vatsapatel@microsoft.colm <vatsapatel@microsoft.colm>

* Address Authorizations MissingTypeObject errors (Azure#20919)

* Add forgotten If-Match header (Azure#20920)

* Add forgotten If-Match header

`If-Match` header for the `DeleteAuthorizationAccessPolicy.json file` was forgotten. This change adds the wildcard character for the `If-Match` header for that file.

* Update ApiManagementDeleteAuthorization.json

* Use common types for specs and count as readonly (Azure#21023)

* common types

* count readonly

* Sasolank/more review comments (Azure#21025)

* XML

* proxy to gateway

* Update Authorizations Spec (Azure#21027)

* Update definitions.json

Update wording for PostGetLoginLink endpoint description

* Update apimauthorizationproviders.json

Add 201 response to all Authorization PUT requests

* Updated examples and fixed formatting

There was a formatting issue within apimauthorizationproviders.json, and the Authorization examples needed to be updated with the new 201 responses for creating/updating Authorization entities.

* Add long-running-operation key/value

Added x-ms-long-running-operation: true to Authorization PUT requests

* Remove long-running-operations

* readonly revert (Azure#21050)

* Set  SchemaContract.Document as required. (Azure#20110)

* Updated documentation of the SchemaContract. Server use to return code 500 in case SchemaContract.Document is null. That issue was fixed in the APIM and server will return proper response code.

* Fix AzureApiValidation

* update field with properties

* revert remaining readonly on collection (Azure#21051)

* Change to camel casing for "accesspolicies" (Azure#21070)

* Change to camel casing for "accesspolicies"

* More camel casing updates for access policies

* list example fixed (Azure#21089)

* fix definition (Azure#21110)

* upgrade to v3 for common types (Azure#21109)

* upgrade to v3

* Space

* revert to v2 proxyResource

Co-authored-by: Milan Zolota <Hardell@users.noreply.github.com>
Co-authored-by: Milan Zolota <mizolota@microsoft.com>
Co-authored-by: Sean D Kim <seandkim14@gmail.com>
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Co-authored-by: Annaji Sharma Ganti <anganti@microsoft.com>
Co-authored-by: Annaji Sharma Ganti <42851022+annaji-msft@users.noreply.github.com>
Co-authored-by: Tom Kerkhove <kerkhove.tom@gmail.com>
Co-authored-by: Korolev Dmitry <deagle.gross@gmail.com>
Co-authored-by: Logan Zipkes <44794089+LFZ96@users.noreply.github.com>
Co-authored-by: Rafał Mielowski <mielex@gmail.com>
Co-authored-by: malincrist <92857141+malincrist@users.noreply.github.com>
Co-authored-by: GuanchenIntern <109827715+GuanchenIntern@users.noreply.github.com>
Co-authored-by: VatsaPatel <vatsapatel13@gmail.com>
Co-authored-by: Vatsa Patel <vatsapatel@microsoft.com>
Co-authored-by: vatsapatel@microsoft.colm <vatsapatel@microsoft.colm>
Co-authored-by: Maxim Agapov <103097563+agapovm@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs
Projects
None yet
Development

No branches or pull requests

2 participants