Skip to content

ConcurrentModificationException from SequentialSpace class #21

@Uabanur

Description

@Uabanur

When performing queryAll on a SequentialSpace in a SpaceRepository, ConcurrentModificationExceptions are occasionally thrown. The code where this is observed most often is:

    public String[] getUsers()
    {
        List<Object[]> users = this.queryAll(new FormalField(String.class));
        String[] users_string = new String[users.size()];
        for (int i = 0; i < users.size(); i++)
        {
            users_string[i] = (String) users.get(i)[0];
        }

        return users_string;
    }

Here the ConcurrentModificationException is thrown from the line with queryAll(...). Looking in the SequentialSpace class, we see that the methods findTuple(...)and findAllTuples(...)are not synchronised in the java monitor.

This may be a deliberate choice to make it possible to query concurrently for several threads, but the concurrent exceptions are thrown since the found elements are returned, instead of a copy of their data.

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