Skip to content

Excessive lock contention in ExecutionContext.getErrors()  #2369

@dfa1

Description

@dfa1

Describe the bug
According to yourkit [1] we have a lot of blocking happening in this line (almost all red blocks are related to this line):

overallResult.complete(new ExecutionResultImpl(builder.build(), executionContext.getErrors()));

as ExecutionContext defines it as synchronizedList:

    private final List<GraphQLError> errors = Collections.synchronizedList(new ArrayList<>());

    /**
     * @return the total list of errors for this execution context
     */
    public List<GraphQLError> getErrors() {
        return ImmutableList.copyOf(errors);
    }

[1] MicrosoftTeams-image (4)

To Reproduce
I don't have reproducer but, right now we have a workaround to get the "errors" via reflection, that delivers a massive improvement.

@andimarek @bbakerman IIRC we already discussed this once

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions