Commit Graph
18 Commits
Author SHA1 Message Date
nghianguyenandClaude Opus 5 86b520d85c ANSAWSS3: recover from dead sockets, and report why an upload failed
Field logs showed clusters of uploads taking exactly 20004/20007/20003 ms —
the default _idleTimeoutMs — across several workers at the same instant, then
recurring. Cause: a connection whose request failed was returned to the pool,
so a socket silently dropped by a middlebox was handed to worker after worker,
each paying the full idle timeout to rediscover it. Chilkat's autoReconnect
only covers a cleanly closed connection, not a half-open one.

Connection handling:
- DiscardConnection(): a TRANSPORT failure closes the connection instead of
  pooling it (23 sites). An HTTP error status is not a transport failure - the
  server answered - so those connections are still reused.
- Pooled connections idle longer than 15 s are dropped at acquire time.
- First request on a reused connection uses a short idle timeout (a quarter of
  the configured one, 5 s by default); a fresh connection keeps the full one.
  A dead socket now costs ~5 s once, not 20 s repeatedly.
- One upload call is capped at 30 s wall-clock. The attempt count alone was not
  a time bound: 20 attempts x 20 s could block the caller for ~400 s.
- RetryLoop no longer gives up after one failed connect. Callers call Connect()
  once at startup, so returning left the handle dead for the process lifetime.
  Now backs off 3 s -> 30 s until connected or stopped.
- Connections carry the config generation they were built against, so a connect
  completing just after SetAuthentication cleared the pool cannot leave an
  unauthenticated connection behind (those uploads would 403).
- Stale per-request state is cleared on acquire: multipart uploadId/partNumber
  query params, and the gzip Content-Encoding set by UploadTextData. Not
  ClearAllHeaders - that wipes SigV4 state (fcc985e).

Return codes - upload exports now say whether a retry is worthwhile:
-20 permanent (bad argument, licence, or HTTP 4xx), -21 not connected yet,
-22 transient. Recorded per thread, since one handle is shared by many workers.
Success stays the only positive value, so rc == 1 and rc != 1 are unchanged.
Handle and exception codes (-1/-3/-4) made consistent across all upload
wrappers; some previously returned 0 for these.

Also fixes a misclassification this surfaced: Chilkat reports failure for an
HTTP 4xx delivered during an Expect: 100-continue exchange, so NoSuchBucket was
treated as a network error and retried 20 times before reporting "transient".
The failure path now checks the response status. Chilkat's ~2 KB error dump per
failure is compressed to one line carrying the actual S3 error code.

Verified against live S3: 14,701 uploads across 15 threads with a 150 s idle
gap, 0 failures, no call over 5 s (avg 90 ms, p95 136 ms), matching the
pre-change baseline; and all six return-code classes confirmed end to end.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-12 21:24:12 +10:00
nghianguyen b3436a61ee Prevent OOM 2026-06-18 05:55:31 +10:00
nghianguyen ebba70b9d9 Support Get log events 2026-05-24 09:19:24 +10:00
nghianguyen 47b80102a8 Add port to scanning devices 2026-05-24 08:33:34 +10:00
nghianguyen a2fa2c8ceb Support scanning ANSVIS servers device 2026-05-23 18:03:22 +10:00
nghianguyen 214f598e18 Support Generate Presigned URL for S3 2026-05-19 10:37:46 +10:00
nghianguyen da94e7f6da strip sensitive information from logs 2026-04-26 07:35:30 +10:00
nghianguyen 3418090042 - Remove ALPR_OD Tracker and voting system.
- Disable debugview
2026-04-19 23:15:50 +10:00
nghianguyen 51fe507dfd Fix unregister issue 2026-04-19 14:47:29 +10:00
nghianguyen 2de11c4b0c Fix: remove the leak protection entirely 2026-04-18 20:51:50 +10:00
nghianguyen 247c91db50 Fix ANSAWS3 multiple instance creation 2026-04-18 20:33:44 +10:00
nghianguyen a47ea25e8b Fix Image management (BMP, BMPtoJPEG) and remove debug info from AWS Upload 2026-04-17 20:59:21 +10:00
nghianguyen 69787b0ff0 Fix AMD and OpenVINO 2026-04-08 13:45:52 +10:00
nghianguyen cb3e856a6e Add more unicode APIs 2026-04-07 07:59:46 +10:00
nghianguyen b98aed21bf Support unicode APIs for LabVIEW 2026-04-06 14:20:43 +10:00
nghianguyen ccfc5964d4 Support UTF8 to UTF16 LE.
Support Unicode helper
Fix ANSFR to show 2 same faces in 1 image
2026-03-31 21:52:47 +11:00
nghianguyen 70be68d0fc Support UTF8 to UTF16 LE 2026-03-31 14:10:21 +11:00
nghianguyen 8a2e721058 Refactor project structure 2026-03-28 19:56:39 +11:00