Skip to content

LDEV-6243, LDEV-6244, LDEV-6245: fix race condition, perf improvements#36

Merged
zspitzer merged 9 commits into
masterfrom
image-3.0.1.3-fixes
Apr 9, 2026
Merged

LDEV-6243, LDEV-6244, LDEV-6245: fix race condition, perf improvements#36
zspitzer merged 9 commits into
masterfrom
image-3.0.1.3-fixes

Conversation

@zspitzer
Copy link
Copy Markdown
Member

@zspitzer zspitzer commented Apr 9, 2026

Summary

Three tickets, 9 commits. Bug fix + performance improvements found via JFR profiling.

LDEV-6243 — member function race condition

CommonUtil.getMembers() publish-before-populate race causes intermittent Can't cast Object type [Struct] to a value of type [image] on member function calls under concurrency (~1% failure rate).

Fix: Double-checked locking with volatile, build into local before publish.

LDEV-6244 — replace GetApplicationSettings BIF

getCoders() called GetApplicationSettings BIF via reflection on every image operation, triggering 128k DummyWSHandler exceptions per benchmark run.

Fix: Use pc.getApplicationContext().getCustom("image") directly, same pattern as extension-s3. Also fixes the missing o = assignment for the "coders" fallback key.

LDEV-6245 — performance (5 fixes)

  • Remove redundant _coder static cache (if (true || bypass)
  • Fix missing return in AImageIOInterface.write() — was writing files twice
  • Stop throwing exceptions for format matching — invert delegation in getFormatbyMimeType
  • Resolve MIME type (Tika) once per operation and pass to coders via new FormatExtract overload
  • Add misnamed file tests (JPEG as .png, PNG as .jpg, WebP as .jpg, etc.)

Benchmark results (5k ops, inspect never)

Test Before After Change
image-read 872/s 1,230/s +41%
image-convert 272/s 453/s +67%
image-info 801/s 1,093/s +36%
image-write 306/s 333/s +9%
image-resize 250/s 270/s +8%

Exceptions: 354,332 → 2,309 (-99.3%)

Test plan

  • All existing image tests pass (testLabels=image, Failures: 0)
  • New misnamed file tests pass (8 tests — JPEG/PNG/WebP with wrong extensions)
  • Member function race verified: 0 failures post-fix (was 23/2002)
  • Benchmarked with JFR before and after

@zspitzer zspitzer merged commit 2bd067d into master Apr 9, 2026
23 checks passed
@zspitzer zspitzer deleted the image-3.0.1.3-fixes branch April 9, 2026 10:13
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.

1 participant