Skip to content

Concurrency problem in DeferredResult: potential double execution of handleResult [SPR-14978] #19544

Closed
@spring-projects-issues

Description

@spring-projects-issues

yan.zhang opened SPR-14978 and commented

!bug.jpg|thumbnail!

It looks like a concurrency bug.

"this.resultHandler.handleResult(this.result);" may be executed twice.

I think it shoule be:

    private boolean setResultInternal(Object result) {
        synchronized (this) {
            if (isSetOrExpired()) {
                return false;
            }
            this.result = result;

            if (this.resultHandler != null) {
                this.resultHandler.handleResult(this.result);
            }
        }
        return true;
    }

Affects: 3.2.17, 4.2.8, 4.3.4, 5.0 M3

Reference URL: https://github.com/spring-projects/spring-framework/blob/v5.0.0.M3/spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java

Attachments:

Issue Links:

Backported to: 4.2.9, 3.2.18

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions