Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 12, 2026

Proposed changes

The client logs BadRequestTimeout (0x80850000) as "Unhandled error during Publish" when servers return timeout responses to Publish requests. Per OPC UA spec, publish timeouts are expected operational behavior, not errors.

Change: Add StatusCodes.BadRequestTimeout to the switch statement in Session.OnPublishComplete() alongside StatusCodes.BadTimeout. Both now break to QueueBeginPublish(), which queues a new publish request without error logging.

case StatusCodes.BadTimeout:
case StatusCodes.BadRequestTimeout:  // Added
    break;

This eliminates spurious error logs while maintaining correct publish pipeline behavior.

Related Issues

Issue reference handled by system.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Test enhancement (non-breaking change to increase test coverage)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, requires version increase of Nuget packages)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc.
  • I have signed the CLA.
  • I ran tests locally with my changes, all passed.
  • I fixed all failing tests in the CI pipelines.
  • I fixed all introduced issues with CodeQL and LGTM.
  • I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added necessary documentation (if appropriate).
  • Any dependent changes have been merged and published in downstream modules.

Further comments

Minimal single-line change. Existing tests cover the publish pipeline behavior; new behavior mirrors existing BadTimeout handling.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Client] PUBLISH x - Unhandled error 0x80850000 during Publish. --> Client should handle BadPublishTimeout code from the Server gracefully</issue_title>
<issue_description>Test logs are full of log entries like:

SubscriptionTest TransferSubscriptionOnlyAsync(DisconnectedRepublishDelayedAck,False,False)
	TEST 22:07:00.437 [Opc.Ua.Client.Session] PUBLISH OPCFoundation/UA-.NETStandard#10 - Unhandled error 0x80850000 during Publish.
	[AggregateException] One or more errors occurred.
	---    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
	---    at Opc.Ua.Client.Session.OnPublishComplete(Task`1 task, NodeId sessionId, SubscriptionAcknowledgementCollection acknowledgementsToSend, RequestHeader requestHeader) in /_/Libraries/Opc.Ua.Client/Session/Session.cs:line 3444
	>>>> (Inner OPCFoundation/UA-.NETStandard#1) >>>>
	[ServiceResultException] [80850000]
	---    at Opc.Ua.Bindings.ChannelAsyncOperation`1.<EndAsync>d__12.MoveNext() in /_/Stack/Opc.Ua.Core/Stack/Tcp/ChannelAsyncOperation.cs:line 317
	--- --- End of stack trace from previous location where exception was thrown ---
	---    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	---    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	---    at Opc.Ua.Bindings.UaSCUaBinaryClientChannel.<SendRequestAsync>d__4.MoveNext() in /_/Stack/Opc.Ua.Core/Stack/Tcp/UaSCBinaryClientChannel.cs:line 339
	--- --- End of stack trace from previous location where exception was thrown ---
	---    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	---    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	---    at Opc.Ua.SessionClient.<PublishAsync>d__127.MoveNext() in /_/Stack/Opc.Ua.Core/Stack/Generated/Opc.Ua.Client.cs:line 10490
SubscriptionTest TransferSubscriptionOnlyAsync(DisconnectedRepublishDelayedAck,False,False)
	TEST 22:07:00.437 [Opc.Ua.Client.Session] PUBLISH OPCFoundation/UA-.NETStandard#8 - Unhandled error 0x80850000 during Publish.
	[AggregateException] One or more errors occurred.
	---    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
	---    at Opc.Ua.Client.Session.OnPublishComplete(Task`1 task, NodeId sessionId, SubscriptionAcknowledgementCollection acknowledgementsToSend, RequestHeader requestHeader) in /_/Libraries/Opc.Ua.Client/Session/Session.cs:line 3444
	>>>> (Inner OPCFoundation/UA-.NETStandard#1) >>>>
	[ServiceResultException] [80850000]
	---    at Opc.Ua.Bindings.ChannelAsyncOperation`1.<EndAsync>d__12.MoveNext() in /_/Stack/Opc.Ua.Core/Stack/Tcp/ChannelAsyncOperation.cs:line 317
	--- --- End of stack trace from previous location where exception was thrown ---
	---    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	---    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	---    at Opc.Ua.Bindings.UaSCUaBinaryClientChannel.<SendRequestAsync>d__4.MoveNext() in /_/Stack/Opc.Ua.Core/Stack/Tcp/UaSCBinaryClientChannel.cs:line 339
	--- --- End of stack trace from previous location where exception was thrown ---
	---    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	---    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	---    at Opc.Ua.SessionClient.<PublishAsync>d__127.MoveNext() in /_/Stack/Opc.Ua.Core/Stack/Generated/Opc.Ua.Client.cs:line 10490

Those indicate a BadPublishTimeout StatusCode returned from the Server. Such StatusCodes need to be handled gracefully by the Client, as those are expected to be returned by the server.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Handle BadPublishTimeout error during Publish Handle BadRequestTimeout gracefully in Publish error handling Jan 12, 2026
Copilot AI requested a review from romanett January 12, 2026 05:11
@romanett romanett marked this pull request as ready for review January 12, 2026 05:14
@marcschier marcschier merged commit 78a5470 into master Jan 12, 2026
111 of 112 checks passed
@romanett romanett deleted the copilot/handle-bad-publish-timeout branch January 12, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Client] PUBLISH x - Unhandled error 0x80850000 during Publish. --> Client should handle BadPublishTimeout code from the Server gracefully

4 participants