我遇到了一个无法解决的databricks问题。获取的错误是: An error occurred while calling o554.fit. : java.lang.OutOfMemoryError: Java heap space
这导致我认为没有足够的空间来进行所需的计算(我正在做一个朴素的贝叶斯分类)。但是,我使用的数据并没有那么大(150MB用于测试目的)。有什么问题吗?
我试过:
强制垃圾回收
获得更大的集群/更小的集群/更多的工人/更少的工人
创建新群集
重新启动群集
清除缓存
spark.sparkcontext.stop()
奇怪的是,代码以前是运行的,但现在仍然卡在这种情况下。在spark ui metric选项卡中检查内存使用情况时,我可以看到它非常高,甚至在刚刚启动集群时也是如此。还有什么我可以试试的建议吗?
编辑:我正在使用spark 2.4.5
完整错误代码:
<command-2419111842344626> in <module>
----> 1 nbModel = nb.fit(trainingData)
/databricks/spark/python/pyspark/ml/base.py in fit(self, dataset, params)
130 return self.copy(params)._fit(dataset)
131 else:
--> 132 return self._fit(dataset)
133 else:
134 raise ValueError("Params must be either a param map or a list/tuple of param maps, "
/databricks/spark/python/pyspark/ml/wrapper.py in _fit(self, dataset)
293
294 def _fit(self, dataset):
--> 295 java_model = self._fit_java(dataset)
296 model = self._create_model(java_model)
297 return self._copyValues(model)
/databricks/spark/python/pyspark/ml/wrapper.py in _fit_java(self, dataset)
290 """
291 self._transfer_params_to_java()
--> 292 return self._java_obj.fit(dataset._jdf)
293
294 def _fit(self, dataset):
/databricks/spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py in __call__(self, *args)
1255 answer = self.gateway_client.send_command(command)
1256 return_value = get_return_value(
-> 1257 answer, self.gateway_client, self.target_id, self.name)
1258
1259 for temp_arg in temp_args:
/databricks/spark/python/pyspark/sql/utils.py in deco(*a,**kw)
61 def deco(*a,**kw):
62 try:
---> 63 return f(*a,**kw)
64 except py4j.protocol.Py4JJavaError as e:
65 s = e.java_exception.toString()
/databricks/spark/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
326 raise Py4JJavaError(
327 "An error occurred while calling {0}{1}{2}.\n".
--> 328 format(target_id, ".", name), value)
329 else:
330 raise Py4JError(
Py4JJavaError: An error occurred while calling o554.fit.
: java.lang.OutOfMemoryError: Java heap space
at org.apache.spark.ml.classification.NaiveBayes$$anonfun$trainWithLabelCheck$1.apply(NaiveBayes.scala:186)
at org.apache.spark.ml.classification.NaiveBayes$$anonfun$trainWithLabelCheck$1.apply(NaiveBayes.scala:129)
at org.apache.spark.ml.util.Instrumentation$$anonfun$14.apply(Instrumentation.scala:277)
at scala.util.Try$.apply(Try.scala:192)
at org.apache.spark.ml.util.Instrumentation$.instrumented(Instrumentation.scala:277)
at org.apache.spark.ml.classification.NaiveBayes.trainWithLabelCheck(NaiveBayes.scala:129)
at org.apache.spark.ml.classification.NaiveBayes.train(NaiveBayes.scala:118)
at org.apache.spark.ml.classification.NaiveBayes.train(NaiveBayes.scala:78)
at org.apache.spark.ml.Predictor.fit(Predictor.scala:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:380)
at py4j.Gateway.invoke(Gateway.java:295)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:251)
at java.lang.Thread.run(Thread.java:748)
编辑2:按要求编辑图片
DagJobsecutor公司
暂无答案!
目前还没有任何答案,快来回答吧!