[MGNLIMG-227] Corrupt imaging URLs causing 500 errors Created: 31/Mar/21  Updated: 26/Sep/22

Status: Open
Project: Imaging
Component/s: cache, image operations
Affects Version/s: 3.4.4
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: fabian schneider Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2021-03-31-10-01-55-959.png    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Date of First Response:
Epic Link: Support
Team: DeveloperX

 Description   

Steps to reproduce

  1.  open corrupt imaging URL:

https://demoauthor.magnolia-cms.com/.imaging/mte/travel-demo-theme/1366/dam/tours/simon-mumenthaler-1...

(Correct would be https://demoauthor.magnolia-cms.com/.imaging/mte/travel-demo-theme/1366/dam/tours/simon-mumenthaler-199501-unsplash/jcr:content/simon-mumenthaler-199501-unsplash.jpg

Expected results

404 response

Actual results

500 response with stacktrace

Development notes

The error is probably caused by wrapping the ImagingException into a RuntimeException:

CachingImageStreamer.java:126

// We're (ab)using CacheLoader -- this is NOT the cache. We're merely using it to schedule concurrent image generation jobs.
.build(new CacheLoader<ImageGenerationJob<P>, Property>() {

    @Override
    public Property load(ImageGenerationJob<P> job) throws Exception {
        try {
            return generateAndStore(job.getGenerator(), job.getParams());
        } catch (IOException | ImagingException e) {
            // the LoadingCache will further wrap these in ExecutionExceptions, and we will, in turn, unwrap them ...
            throw new RuntimeException(e);
        }
    }
});

It should probably be unpacked here again:
CachingImageStreamer.java:149

} catch (ExecutionException e) {
    // thrown if the LoadingCache's Function failed
    unwrapRuntimeException(e);
}

However, a breakpoint here does not hit.


Generated at Mon Feb 12 02:13:31 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.