Skip to content

[Bug] Schema Cache expandCapacity concurrent issue #2330

@qwtsc

Description

@qwtsc

Bug Type (问题类型)

other exception / error (其他异常报错)

Before submit

  • 我已经确认现有的 IssuesFAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)

Environment (环境信息)

see the following error-log

org.apache.hugegraph.exception.ServerException: Index 32 out of bounds for length 32

Expected & Actual behavior (期望与实际表现)

    public void set(int key, V value) {
        if (key >= this.currentSize) {
            this.expandCapacity();
        }
        // this.array is not the one that has done expandCapacity!
        this.array[key] = value;
    }

    private synchronized void expandCapacity() {
        if (this.currentSize == this.maxSize) {
            return;
        }
        this.currentSize = Math.min(this.currentSize * 2, this.maxSize);
        Object[] newArray = new Object[this.currentSize];
        System.arraycopy(this.array, 0, newArray, 0, this.array.length);
        this.clear();
        this.array = newArray;
    }

Vertex/Edge example (问题点 / 边数据举例)

No response

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions