Skip to content

OutOfMemory when creating table with large replicas #16668

Closed

Description

@suyZhong

CrateDB version

CrateDB 5.9.0-SNAPSHOT built f52fecc

CrateDB setup information

Manual build following the instructions here: https://github.com/crate/crate/blob/master/devs/docs/basics.rst

Problem description

Consider the test case below. The second CREATE TABLE caused the server to hang and then crash. I suppose if we throw one error for the first statement correctly, then it should also be for the second one.

Steps to Reproduce

CREATE  TABLE  t0(c0 INT)WITH (number_of_replicas = 1000);
-- SQLParseException[Validation Failed: 1: this action would add [4004] total shards, but this cluster currently has [0]/[1000] maximum shards open;]
CREATE  TABLE  t0(c0 INT)WITH (number_of_replicas = 1925152226);
-- hang and crash

Actual Result

server log:


[2024-09-25T07:19:44,566][INFO ][o.e.c.m.MetadataCreateIndexService] [Monte Misa] [t0] creating index, cause [create-table], shards [4]/[1925152226]
[2024-09-25T07:19:55,412][INFO ][o.e.m.j.JvmGcMonitorService] [Monte Misa] [gc][18] overhead, spent [287ms] collecting in the last [1s]
[2024-09-25T07:20:02,943][WARN ][o.e.m.j.JvmGcMonitorService] [Monte Misa] [gc][24] overhead, spent [1.6s] collecting in the last [2.4s]
[2024-09-25T07:20:05,143][WARN ][o.e.m.j.JvmGcMonitorService] [Monte Misa] [gc][26] overhead, spent [1s] collecting in the last [1.1s]
[2024-09-25T07:20:06,308][WARN ][o.e.m.j.JvmGcMonitorService] [Monte Misa] [gc][27] overhead, spent [962ms] collecting in the last [1.1s]
[2024-09-25T07:20:07,333][WARN ][o.e.m.j.JvmGcMonitorService] [Monte Misa] [gc][28] overhead, spent [949ms] collecting in the last [1s]
[2024-09-25T07:20:09,561][WARN ][o.e.m.j.JvmGcMonitorService] [Monte Misa] [gc][29] overhead, spent [2.2s] collecting in the last [2.2s]
[2024-09-25T07:20:11,042][WARN ][o.e.m.j.JvmGcMonitorService] [Monte Misa] [gc][30] overhead, spent [1.2s] collecting in the last [1.4s]
[2024-09-25T07:20:12,096][WARN ][o.e.m.j.JvmGcMonitorService] [Monte Misa] [gc][31] overhead, spent [1s] collecting in the last [1s]
[2024-09-25T07:20:15,681][WARN ][o.e.m.j.JvmGcMonitorService] [Monte Misa] [gc][32] overhead, spent [3.5s] collecting in the last [3.5s]
java.lang.OutOfMemoryError: Java heap space
Dumping heap to /data/data/java_pid1.hprof ...
Heap dump file created [53365619821 bytes in 153.714 secs]
[2024-09-25T07:22:59,091][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [Monte Misa] fatal error in thread [cratedb[Monte Misa][scheduler][T#1]], exiting
java.lang.OutOfMemoryError: Java heap space
	at java.management/sun.management.MemoryImpl.getMemoryUsage0(Native Method) ~[?:?]
	at java.management/sun.management.MemoryImpl.getHeapMemoryUsage(MemoryImpl.java:72) ~[?:?]
	at org.elasticsearch.monitor.jvm.JvmStats.jvmStats(JvmStats.java:60) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.monitor.jvm.JvmGcMonitorService$JvmMonitor.jvmStats(JvmGcMonitorService.java:497) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.monitor.jvm.JvmGcMonitorService$JvmMonitor.monitorGc(JvmGcMonitorService.java:417) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.monitor.jvm.JvmGcMonitorService$JvmMonitor.run(JvmGcMonitorService.java:406) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.threadpool.Scheduler$ReschedulingRunnable.doRun(Scheduler.java:218) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[crate-server-5.9.0.jar:?]
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.base/java.lang.Thread.runWith(Thread.java:1583) ~[?:?]
	at java.base/java.lang.Thread.run(Thread.java:1570) [?:?]
[2024-09-25T07:22:59,091][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [Monte Misa] fatal error in thread [cratedb[Monte Misa][masterService#updateTask][T#1]], exiting
java.lang.OutOfMemoryError: Java heap space
	at org.elasticsearch.cluster.routing.ShardRouting.newUnassigned(ShardRouting.java:102) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.routing.IndexRoutingTable$Builder.initializeEmpty(IndexRoutingTable.java:439) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.routing.IndexRoutingTable$Builder.initializeAsNew(IndexRoutingTable.java:337) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.routing.RoutingTable$Builder.addAsNew(RoutingTable.java:491) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.metadata.MetadataCreateIndexService.addIndex(MetadataCreateIndexService.java:772) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.metadata.MetadataCreateIndexService.lambda$add$4(MetadataCreateIndexService.java:714) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.metadata.MetadataCreateIndexService$$Lambda/0x0000000050aeb628.apply(Unknown Source) ~[?:?]
	at org.elasticsearch.indices.IndicesService.withTempIndexService(IndicesService.java:424) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.metadata.MetadataCreateIndexService.add(MetadataCreateIndexService.java:711) ~[crate-server-5.9.0.jar:?]
	at io.crate.execution.ddl.tables.TransportCreateTableAction$1.execute(TransportCreateTableAction.java:180) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:45) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:665) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:280) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:175) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.service.MasterService.lambda$doStart$0(MasterService.java:121) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.service.MasterService$$Lambda/0x0000000050a26cc8.accept(Unknown Source) ~[?:?]
	at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:170) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.cluster.service.BatchedTask.run(BatchedTask.java:70) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231) ~[crate-server-5.9.0.jar:?]
	at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194) ~[crate-server-5.9.0.jar:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.base/java.lang.Thread.runWith(Thread.java:1583) ~[?:?]
	at java.base/java.lang.Thread.run(Thread.java:1570) [?:?]

Expected Result

An error message.

Activity

  1. added
    triageAn issue that needs to be triaged by a maintainer
    on Sep 25, 2024
  2. added
    bugClear identification of incorrect behaviour
    and removed
    triageAn issue that needs to be triaged by a maintainer
    on Sep 25, 2024
  3. self-assigned this
    on Sep 25, 2024
  4. added 4 commits that reference this issue on Sep 25, 2024
    8d01718
    37df5d3
    69db674
    633b8d3
  5. added a commit that references this issue on Sep 25, 2024
    bd037be
  6. seut commented on Sep 25, 2024

    @seut
    Member

    @suyZhong Thank you for reporting. The fix will be released with the next 5.8.4 hotfix release

  7. added a commit that references this issue on Sep 25, 2024
    0e09062
  8. added a commit that references this issue on Sep 25, 2024
    37adcff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugClear identification of incorrect behaviour

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions