IMD SolutionComputing LibraryShop main store

Troubleshooting

Why PI AF SDK reads fail with PINET error -10722 on long exports

Edge computing and IIoT Published 6 min read By IMD Solution engineering team

Short answer

PINET error -10722 means one PI RPC or system call exceeded its timeout; on a long export it is an oversized archive request, usually a busy point over a wide interval, not a connection that expires with duration. Keep one PIServer instance for the session, split the reads until each completes on its event count, and read the PI Message Logs on the client and the archive node to separate workload from connectivity.

On this page
  1. What the -10722 exception does and does not say
  2. Keep one PIServer instance for the whole session
  3. Size the weekly chunks by measured event count
  4. Separate workload from connectivity with both message logs
  5. Prove the export end to end, then run it
  6. Questions asked

Error -10722 arrives as OSIsoft.AF.PI.PITimeoutException with the message [-10722] PINET: Timeout on PI RPC or System Call: one PI call ran past its timeout and was abandoned. On a long tag export it almost never means the connection wears out with running time. It means one oversized archive request, typically a busy point over a wide interval. The fix is to keep a single PIServer instance for the whole session, split the reads until each one's event count is small enough to complete, and read the PI Message Log on both the client and the archive node to tell workload from connectivity.

What the -10722 exception does and does not say #

The exception names a failure class — a PI RPC or system call that did not complete within its timeout — and nothing else. It does not identify the bottleneck, and it is not evidence of a session time limit.

  • The timeout belongs to a single call. The next call can succeed right after one fails, which is why the export dies partway through a tag instead of at the start.
  • Elapsed running time does not feed the exception. A session that has read for hours is no closer to this error than one that just began; only the size of the request in flight matters.
  • A valid point can still be an expensive request. Retrieval cost follows the event count of the interval, not the tag count of the list, so a correct tag list does not protect a dense point.
  • Before changing anything, record the failing tag, the interval, and the stage the exception fired in — archive retrieval, not point lookup and not the CSV write — and keep that pair as the reproduction case.

Keep one PIServer instance for the whole session #

Create the PIServer object once, at export-session scope, and pass it into the function that reads one interval and writes one CSV chunk — ReadWriteTagData is what one such export script calls it. The object handles connection issues by itself and reconnects as needed; the connection should stay open for as long as the application is requesting data.

  • Instantiating the server inside the per-interval function repeats connection setup and authentication on every call while doing nothing about the archive work of any single read. The read that was too big is still too big.
  • Fewer timeouts in a handful of small tests with a per-call connection is not a controlled comparison, because the tags, intervals and server load changed together with the connection scope. Settle it by running one known failing tag and interval twice, once per scope.
  • Pass the selected tag and the interval in as explicit parameters. A list index read from outer scope can make the script query a different point than its progress output names, and then the logs and the reproduction case disagree.

Size the weekly chunks by measured event count #

A week is a time boundary, not an amount of data. The right chunk is the one whose event count the archive serves within the timeout, and you find it by measuring.

Worked example, assuming a point recorded once per second and three such tags over eight years:

  • One week of that point is 7 days × 24 hours × 3,600 seconds = 604,800 events.
  • A point recorded every ten seconds returns a tenth of that for the same week: 60,480 events.
  • Eight years is 8 × 365.25 = 2,922 days, or 2,922 ÷ 7 ≈ 417 weekly reads per tag; three tags make about 1,251 requests.
  • The whole export is 3 × 417 × 604,800 ≈ 757 million events. That total explains why the job runs long; it is not why it fails.
  • The failure is the single weekly request of 604,800 events that outran the timeout. Split the dense week into seven daily reads of 86,400 events each and confirm with a measured read.

To find your own boundary:

  • Run the exact failed tag and week alone; capture elapsed read time, outcome, and the event count when it succeeds.
  • Split that week into adjacent smaller intervals and repeat; the largest interval that completes reliably is the chunk.
  • Run a known-good tag over the same dates; if it also slows, the condition is the server, not the point.
  • AF SDK documents PIPagingConfiguration as the class that describes how PIPointList and AFListData data access calls page through data; bound the per-call work there as well as in the interval width.
  • Check the read call's boundary semantics before joining chunks; get them wrong and rows duplicate or vanish at every seam.
  • When the report needs evenly spaced samples rather than raw events, the approach in exporting historian trend CSV at one-minute intervals shrinks the response as well.
  • Running each week as its own scheduled job, the pattern covered for scheduling weekly CSV exports of historic point data, bounds every request and spreads the archive load.

Separate workload from connectivity with both message logs #

Read the PI Message Log on the client and on the PI Data Archive node around the recorded failure time. The client log shows the timeout without the server-side condition; the server log alone misses the client's connection context. Align the two machines' clocks, or note the offset, before matching entries.

Pattern in the logs Where to look Decision
The same point or interval fails every time Export log and archive-side messages Data density: split that interval further
Unrelated points fail at similar times Both message logs Shared server load or communication: check concurrent users and the network
Connection interruptions beside the timeout Both logs and network diagnostics Fix connectivity first; chunk size is not the cause
Long reads with no connection errors Read timing and server diagnostics Request workload: keep one instance, shrink the chunks
  • A remote read that fails on every call, whatever the interval, is an identity problem rather than this timeout — the signature covered in a remote AF SDK read that fails with a separate Data Archive identity.
  • Late-arriving values in the archive log point to the event queue flush period behind seconds-late archive data, a different fault from a read timeout.
  • On the client, launch AboutPI-SDK.exe and open its Connections tab to see the connection in use for the selected Data Archive; check it while reproducing the failing read.
  • The vendor's KB00232 article on this error lists further steps; take it through the official support channel, and locate the timeout that applies to the actual client operation before changing any setting.

Prove the export end to end, then run it #

One completed read proves one request. Before the full run, validate the whole path — tag selection from the CSV list, archive retrieval, durable file write — on a slice that contains the interval that used to fail.

  • Log connection exceptions, read timeouts and write failures as three separate classes; a growing CSV file is not evidence that the archive reads are healthy.
  • Release the server and file resources on the error path, not only on success, so a failed run restarts cleanly.
  • Re-test with the retained instance: the tag and interval that threw should now complete, and successive reads should show the same application-level server object.

The decision for each case:

  • Dense point over a wide interval: split to days or smaller; keep the measured event count of the completed read as the chunk size.
  • Failures across unrelated tags at the same time: server load or the network, and both message logs decide which.
  • Connection drops beside the timeout: connectivity first, chunks second.
  • Healthy logs with one slow request: smaller chunks; the timeout stays where it is.
  • Every case: one PIServer instance for the session, never one per interval.

Questions asked

Can I raise the PI timeout instead of shrinking the reads?

A longer timeout lets one slow request finish, but that request still costs the archive the same work and holds the server longer for everyone else. Raise it only after both message logs show a healthy server and the event count is one the archive can realistically serve, then re-test the same failing read. Splitting the interval removes the cost instead of paying it.

Why do one or two tags over eight years finish while three tags fail?

Each extra tag adds another full sweep of weekly reads, so the export meets a dense interval or a loaded server more often; the exposure grows, not the difficulty of any single read. Every failure is still one oversized request, so the cure is a smaller request, not a fresh connection between tags.

Where does the Data Archive keep the timeout that -10722 trips?

In the PITIMEOUT table, which stores the Data Archive's configuration and tuning parameters. The vendor documents the archive as designed to work optimally with its defaults, so read the table to see the timeout in force and change it only for a diagnosed case, with vendor guidance, then re-test the same failing read.

How do I keep duplicate or missing rows out of the reassembled CSV?

Adjacent chunks can both return the shared boundary timestamp, writing that event twice, and advancing the next start time past the boundary can drop an event instead. Prove your boundary rule on two adjacent intervals with a known event at the seam, then compare the assembled timestamp count for one week against a single unsplit read of the same week before trusting the chunking.

Keep reading

  • Explainer

    Why PI AF SDK connection failures are slow to surface

    While PI Buffer Subsystem is running, a PI AF SDK write is accepted into the local queue and reports success even with the PI Data Archive unreachable. Detect an outage by reading ConnectionInfo on the PIServer object and adding a timed health read of a known point; in the worked example that flags a dead archive within 13 seconds, where the write path alone can stay green for a full shift.

    Edge computing and IIoT

  • Troubleshooting

    Why a remote AF SDK read fails with a separate Data Archive identity

    The credential passed to PISystem.Connect() authenticates the AF Server only. The PI Data Archive runs a second login against the Windows account your process runs under, or a trust from the client machine, so a remote read of recorded values fails with error -10413, no trust relation, until that account is mapped to a PI identity and the client is trusted. The archive message log in PI SMT names the identity that actually arrived.

    Edge computing and IIoT

  • Explainer

    PI AF SDK: the native path from a C# application to PI

    No driver joins two OPC UA clients, so KEPServerEX needs no new driver for this. Read PI Data Archive and PI Asset Framework from C# through PI AF SDK, which needs the server-side PSA license. Any new values must flow through a real OPC UA server endpoint that a licensed PI OPC UA interface or connector collects from.

    Edge computing and IIoT

What the Historian SDK does with multiple event writes