Status code · Sessions

BadTooManySessions

BadServer limits

BadTooManySessions means the server hit its configured session limit and refused CreateSession. Either the server is genuinely at capacity, or - far more often - dead sessions are still counted because clients reconnect without closing them. Find and close the orphans, then reduce sessions per client.

Defined behaviour: The server has reached the maximum number of Sessions it supports and cannot create another one. (our description of the condition this code reports)

What you actually see

New clients cannot connect while existing ones keep working, and the failure appears at CreateSession rather than at the socket or certificate stage.

Why it happens

  • Orphaned sessions from a reconnect loopA client whose handshake times out retries, and the retry creates a fresh session while the original is orphaned and still counted until its timeout expires. This is a positive-feedback loop: the more the server struggles, the more orphans accumulate, and the limit is reached with almost no real clients attached.
  • A low session limit on an embedded serverPLC-embedded and device servers often allow only a handful of sessions - single digits is common. Two engineering tools, a SCADA connection and a historian can exhaust that budget with nothing pathological happening at all.
  • One session per tag group or per threadCollector configurations that create a session per device, per polling group or per worker multiply session count needlessly. A single session can carry many subscriptions; the practical pattern is one session per client per endpoint.
  • Long session timeouts plus crashing clientsIf a client process is killed, its session lingers for the whole revised session timeout. A ten-minute timeout and a client that crashloops every thirty seconds will pin the session table at its ceiling.
  • Connect storm at plant startupWhen power returns, every client dials at once. Session establishment is CPU-bound on the RSA handshake and chain validation, so the server serialises behind cryptography, handshakes time out, and clients retry - producing both this code and BadServerTooBusy.

How to fix it

In diagnostic order: work down, do not skip ahead.

  1. Count the live sessions on the serverBrowse Server_ServerDiagnostics_SessionsDiagnosticsSummary and read SessionDiagnosticsArray. Each entry carries the client name, ApplicationUri, session name and last-contact time - that is how you identify the orphans and their owner.
  2. Kill the orphans, then look at the ownerShorten the revised session timeout on the server so dead sessions age out faster, or use the vendor's disconnect action. Then fix the client that produced them; leaving it running just refills the table.
  3. Consolidate sessions per clientReconfigure collectors to one session per endpoint with multiple subscriptions rather than one session per group. Also minimise the number of distinct publishing intervals, since each distinct interval forces another subscription and encourages engineers to split into more sessions.
  4. Stagger client connectsAdd a randomised delay and bounded exponential backoff to client startup. Staggering connects is the single most effective client-side measure against connect storms, and it stops the retry loop that manufactures orphans.
  5. Raise the limit only if the hardware supports itMaxSessionCount is configurable on most software servers. Raise it only after checking CPU headroom during handshakes; on an embedded server the limit usually reflects real memory constraints and cannot be moved.

Where it shows up, by tool and stack

Tool / stackWhat to do there
UA-.NETStandard (C#)MaxSessionCount and MinSessionTimeout live in the ServerConfiguration. On a typical multi-core machine the reference server establishes on the order of a thousand or more concurrent sessions cleanly; beyond that, connect throughput is bounded by handshake CPU.
Siemens S7-1500The integrated server supports a small, firmware-dependent number of sessions. Budget them explicitly across TIA Portal, UaExpert, SCADA and any collector, and confirm the current limit against the vendor documentation for your firmware.
KEPServerEXThe UA server interface has a configurable maximum connections setting per endpoint. Client sessions from OPC UA clients and the built-in diagnostics both consume it.
IgnitionEach device connection is its own session by default. Where several logical groups target one server, point them at one connection with multiple tag groups rather than duplicating the connection.
OPC PublisherIt multiplexes many published nodes over a small number of sessions per endpoint. Splitting one endpoint across many published-nodes entries with different settings can, however, create additional sessions.

What it looks like in the log

CreateSession rejected: BadTooManySessions (current=10, max=10)
Session table full; refusing new session from urn:collector01:MyCollector
Client retry after handshake timeout created session 47; previous session 46 orphaned

Confirm the fix

Watch SessionDiagnosticsArray shrink to the number of clients you actually expect, then connect one new client with UaExpert and confirm CreateSession succeeds immediately.

Stop it happening again

Cap sessions per client in configuration standards, use bounded exponential backoff with jitter everywhere, and alarm on the live session count crossing a threshold below the server limit rather than on the refusal itself.

Stuck on more than one of these? The troubleshooting clinic works through broken configurations end to end, on camera.

Troubleshooting clinic →

Last verified 7 September 2026 against OPC UA 1.05.07. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.

Free download
OPC UA Status Code Diagnostic Tree
A 15-page diagnostic reference grouping every normative status code by what actually went wrong: with the first action for each, and the four questions that resolve most faults before you read a single code.
Get the free diagnostic tree →
Free, no course, no login