Java SQL Developer 在 MySQL 数据库上因 GC 开销限制超出错误而冻结
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27300949/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQL Developer freezing with GC overhead limit exceeded error on MySQL database
提问by user1356326
I am trying to use Oracle SQL Developer with a MySQL database. I can connect just fine and I can execute queries, I can see the tables, and with a table selected I can click on all tabs fine with the exception of the "Data" tab. When I click on the "Data" tab, I get a message "Waiting for Editor to initialize" and SQL Developer freezes. After a few minutes I get a message "GC overhead limit exceeded" with the following stack
我正在尝试将 Oracle SQL Developer 与 MySQL 数据库一起使用。我可以很好地连接,我可以执行查询,我可以看到表格,并且选择了一个表格,我可以点击所有选项卡,但“数据”选项卡除外。当我单击“数据”选项卡时,我收到一条消息“正在等待编辑器初始化”并且 SQL Developer 冻结。几分钟后,我收到一条消息“超出 GC 开销限制”,其中包含以下堆栈
java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.mysql.jdbc.MysqlIO.nextRowFast(MysqlIO.java:2114)
at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1921)
at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:3278)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:462)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:2997)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2245)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2638)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2030)
at oracle.dbtools.raptor.controls.grid.ResultSetTableModel.openResultSet(ResultSetTableModel.java:490)
at oracle.dbtools.raptor.controls.grid.ResultSetTableModel.fetchNext(ResultSetTableModel.java:274)
at oracle.dbtools.raptor.controls.grid.ResultSetTableModel.doWork(ResultSetTableModel.java:686)
at oracle.dbtools.raptor.controls.grid.ResultSetTableModel.doWork(ResultSetTableModel.java:670)
at oracle.dbtools.raptor.backgroundTask.RaptorTask.call(RaptorTask.java:193)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager$RaptorFutureTask.run(RaptorTaskManager.java:554)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
I looked around stackoverflow andn google but I could not finf anything that works for me. I am running this on Windows 7 64bit, SQL Developer version 4.0.3.16, MySQL server version 5.5. I have added a line
我环顾了 stackoverflow 和 google,但我找不到任何对我有用的东西。我在 Windows 7 64 位、SQL Developer 版本 4.0.3.16、MySQL 服务器版本 5.5 上运行它。我添加了一行
AddVMOption -Xmx1024M
in the sqldeveloper\sqldeveloper\bin\sqldeveloper.conf file, as suggested here
在 sqldeveloper\sqldeveloper\bin\sqldeveloper.conf 文件中,如此处所建议的
and also added changed the initial and max memory allocation pool sizes in the C:\Users\\AppData\Roaming\sqldeveloper\1.0.0.0.0\product.conf file to
并且还添加了将 C:\Users\\AppData\Roaming\sqldeveloper\1.0.0.0.0\product.conf 文件中的初始和最大内存分配池大小更改为
AddVMOption -Xms512m
and
和
AddVMOption -Xmx1024m
respectively. I am monitoring the performance and I am not running out of memory, but the CPU utilization rate goes above 90%.
分别。我正在监控性能并且我没有耗尽内存,但是 CPU 利用率超过 90%。
Thanks!
谢谢!
回答by anonymous
Is there anyway to set the XX:+UseParallelGC flag on startup? Might help your gc work more efficiently.
无论如何要在启动时设置 XX:+UseParallelGC 标志?可能会帮助您的 gc 更有效地工作。
回答by user2181102
You need to edit the sqldeveloper\sqldeveloper\bin\sqldeveloper.conf
file, adding the following line:-
您需要编辑sqldeveloper\sqldeveloper\bin\sqldeveloper.conf
文件,添加以下行:-
AddVMOption -Xmx1024M
回答by LuizAngioletti
There are 2 parameters for memory in the JVM:
JVM 中的内存有 2 个参数:
XMS
and XMX
.
XMS
和XMX
。
XMS
is the initial size, in bytes, for any JVM being fired-up in your machine.
XMX
is the maximum chunk of memory you'd want to be available to your VMs.
XMS
是在您的机器中启动的任何 JVM 的初始大小(以字节为单位)。
XMX
是您希望 VM 可用的最大内存块。
You should try and increase (with step size depending on your machine) both values.
您应该尝试增加(步长取决于您的机器)这两个值。
Inside your %APPDATA/sqldeveloper/<yourVersion>/product.conf
set the XMS
to any multiple of 128m
with the AddVMOption
parameter.
在您的%APPDATA/sqldeveloper/<yourVersion>/product.conf
设置XMS
中128m
使用AddVMOption
参数的任意倍数。
You could use, for instance
AddVMOption -Xms3072m
例如,您可以使用
AddVMOption -Xms3072m
With this parameter set you can comment out the values eventually set to XMX
.
If you keep receiving the same error, keep on incrementing the parameter until it runs smoothly.
设置此参数后,您可以注释掉最终设置为 的值XMX
。如果您一直收到相同的错误,请继续增加参数,直到它顺利运行。
BE AWARE
意识到
If you, by any chance, set the value of XMS as some value greater than the available memory of your system, you'll receive another error when starting the JVM or any application that runs on top of it.
如果您万一将 XMS 的值设置为大于系统可用内存的某个值,则在启动 JVM 或在其上运行的任何应用程序时,您将收到另一个错误。