Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Py4JNetworkError: An error occurred while trying to connect to the Java server (127.0.0.1:43323) #325

Closed
javeeddanyal opened this issue Jul 2, 2018 · 6 comments

Comments

@javeeddanyal
Copy link

Hy,

I'm trying to run a Spark application on standalone mode with two workers, It's working well for a small dataset. But for a bigger dataset it's failing with this error: After increasing number of workers from two to six same error exist. Probably due to memory overflow!
Version py4j-0.10.7

ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:43323)
Traceback (most recent call last):
File "/home/javeed/spark-2.3.1-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/javeed/spark-2.3.1-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused

IndexError Traceback (most recent call last)
~/spark-2.3.1-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py in _get_connection(self)
928 try:
--> 929 connection = self.deque.pop()
930 except IndexError:

IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

ConnectionRefusedError Traceback (most recent call last)
~/spark-2.3.1-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py in start(self)
1066 try:
-> 1067 self.socket.connect((self.address, self.port))
1068 self.stream = self.socket.makefile("rb")

ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Py4JNetworkError Traceback (most recent call last)
in ()
4 # Build the model
5 t0 = time()
----> 6 dt = DecisionTreeClassifier(featuresCol = 'features', labelCol = 'label', maxDepth = 3)
7 dtModel = dt.fit(train)
8

~/spark-2.3.1-bin-hadoop2.7/python/pyspark/init.py in wrapper(self, *args, **kwargs)
103 raise TypeError("Method %s forces keyword arguments." % func.name)
104 self._input_kwargs = kwargs
--> 105 return func(self, **kwargs)
106 return wrapper
107

~/spark-2.3.1-bin-hadoop2.7/python/pyspark/ml/classification.py in init(self, featuresCol, labelCol, predictionCol, probabilityCol, rawPredictionCol, maxDepth, maxBins, minInstancesPerNode, minInfoGain, maxMemoryInMB, cacheNodeIds, checkpointInterval, impurity, seed)
973 super(DecisionTreeClassifier, self).init()
974 self._java_obj = self._new_java_obj(
--> 975 "org.apache.spark.ml.classification.DecisionTreeClassifier", self.uid)
976 self._setDefault(maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
977 maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,

~/spark-2.3.1-bin-hadoop2.7/python/pyspark/ml/wrapper.py in _new_java_obj(java_class, *args)
59 java_obj = _jvm()
60 for name in java_class.split("."):
---> 61 java_obj = getattr(java_obj, name)
62 java_args = [_py2java(sc, arg) for arg in args]
63 return java_obj(*java_args)

~/spark-2.3.1-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py in getattr(self, name)
1647 proto.REFLECTION_COMMAND_NAME +
1648 proto.REFL_GET_UNKNOWN_SUB_COMMAND_NAME + name + "\n" + self._id +
-> 1649 "\n" + proto.END_COMMAND_PART)
1650 if answer == proto.SUCCESS_PACKAGE:
1651 return JavaPackage(name, self._gateway_client, jvm_id=self._id)

~/spark-2.3.1-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py in send_command(self, command, retry, binary)
981 if binary is True.
982 """
--> 983 connection = self._get_connection()
984 try:
985 response = connection.send_command(command)

~/spark-2.3.1-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py in _get_connection(self)
929 connection = self.deque.pop()
930 except IndexError:
--> 931 connection = self._create_connection()
932 return connection
933

~/spark-2.3.1-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py in _create_connection(self)
935 connection = GatewayConnection(
936 self.gateway_parameters, self.gateway_property)
--> 937 connection.start()
938 return connection
939

~/spark-2.3.1-bin-hadoop2.7/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py in start(self)
1077 "server ({0}:{1})".format(self.address, self.port)
1078 logger.exception(msg)
-> 1079 raise Py4JNetworkError(msg, e)
1080
1081 def _authenticate_connection(self):

Py4JNetworkError: An error occurred while trying to connect to the Java server (127.0.0.1:43323)

Any help?
Thanks

@javeeddanyal
Copy link
Author

2018-07-02 02:00:48 WARN ObjectStore:568 - Failed to get database global_temp, returning NoSuchObjectException
2018-07-02 02:00:52 WARN Utils:66 - Truncated the string representation of a plan since it was too large. This behavior can be adjusted by setting 'spark.debug.maxToStringFields' in SparkEnv.conf.
[I 02:01:11.674 NotebookApp] Saving file at /JupyterNotebook*/Jupyter_Projects/SRP/SRP_MY/Code/LSDM_SMALL_TEST/LSDM_SPARK.ipynb
2018-07-02 02:02:45 WARN BLAS:61 - Failed to load implementation from: com.github.fommil.netlib.NativeSystemBLAS
2018-07-02 02:02:45 WARN BLAS:61 - Failed to load implementation from: com.github.fommil.netlib.NativeRefBLAS
[I 02:03:11.406 NotebookApp] Saving file at /JupyterNotebook*/Jupyter_Projects/SRP/SRP_MY/Code/LSDM_SMALL_TEST/LSDM_SPARK.ipynb
[Stage 308:> (0 + 2) / 2]2018-07-02 02:11:06 WARN MemoryStore:66 - Not enough space to cache rdd_1145_0 in memory! (computed 50.8 MB so far)
2018-07-02 02:11:06 WARN BlockManager:66 - Persisting block rdd_1145_0 to disk instead.
[I 02:11:11.411 NotebookApp] Saving file at /JupyterNotebook*/Jupyter_Projects/SRP/SRP_MY/Code/LSDM_SMALL_TEST/LSDM_SPARK.ipynb
2018-07-02 02:11:12 WARN MemoryStore:66 - Not enough space to cache rdd_1145_1 in memory! (computed 138.5 MB so far)
2018-07-02 02:11:12 WARN BlockManager:66 - Persisting block rdd_1145_1 to disk instead.
[Stage 308:> (0 + 2) / 2][I 02:17:11.414 NotebookApp] Saving file at /JupyterNotebook*/Jupyter_Projects/SRP/SRP_MY/Code/LSDM_SMALL_TEST/LSDM_SPARK.ipynb
[I 02:17:23.369 NotebookApp] Saving file at /JupyterNotebook*/Jupyter_Projects/SRP/SRP_MY/Code/LSDM_SMALL_TEST/LSDM_SPARK.ipynb
[Stage 308:> (0 + 2) / 2]2018-07-02 02:27:13 ERROR Executor:91 - Exception in task 1.0 in stage 308.0 (TID 899)
java.lang.OutOfMemoryError: Java heap space
at java.lang.reflect.Array.newInstance(Array.java:75)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1937)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1565)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2285)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2209)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2285)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2209)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
at org.apache.spark.serializer.JavaDeserializationStream.readObject(JavaSerializer.scala:75)
at org.apache.spark.serializer.DeserializationStream$$anon$1.getNext(Serializer.scala:168)
at org.apache.spark.util.NextIterator.hasNext(NextIterator.scala:73)
at org.apache.spark.storage.memory.MemoryStore.putIteratorAsValues(MemoryStore.scala:216)
at org.apache.spark.storage.BlockManager.maybeCacheDiskValuesInMemory(BlockManager.scala:1239)
at org.apache.spark.storage.BlockManager.getLocalValues(BlockManager.scala:550)
at org.apache.spark.storage.BlockManager.getOrElseUpdate(BlockManager.scala:813)
at org.apache.spark.rdd.RDD.getOrCompute(RDD.scala:335)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:286)
at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:324)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:288)
at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:96)
at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:53)
at org.apache.spark.scheduler.Task.run(Task.scala:109)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:345)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2018-07-02 02:27:13 ERROR SparkUncaughtExceptionHandler:91 - Uncaught exception in thread Thread[Executor task launch worker for task 899,5,main]
java.lang.OutOfMemoryError: Java heap space
at java.lang.reflect.Array.newInstance(Array.java:75)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1937)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1565)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2285)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2209)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2285)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2209)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
at org.apache.spark.serializer.JavaDeserializationStream.readObject(JavaSerializer.scala:75)
at org.apache.spark.serializer.DeserializationStream$$anon$1.getNext(Serializer.scala:168)
at org.apache.spark.util.NextIterator.hasNext(NextIterator.scala:73)
at org.apache.spark.storage.memory.MemoryStore.putIteratorAsValues(MemoryStore.scala:216)
at org.apache.spark.storage.BlockManager.maybeCacheDiskValuesInMemory(BlockManager.scala:1239)
at org.apache.spark.storage.BlockManager.getLocalValues(BlockManager.scala:550)
at org.apache.spark.storage.BlockManager.getOrElseUpdate(BlockManager.scala:813)
at org.apache.spark.rdd.RDD.getOrCompute(RDD.scala:335)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:286)
at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:324)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:288)
at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:96)
at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:53)
at org.apache.spark.scheduler.Task.run(Task.scala:109)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:345)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2018-07-02 02:27:13 WARN TaskSetManager:66 - Lost task 1.0 in stage 308.0 (TID 899, localhost, executor driver): java.lang.OutOfMemoryError: Java heap space
at java.lang.reflect.Array.newInstance(Array.java:75)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1937)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1565)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2285)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2209)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2285)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2209)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
at org.apache.spark.serializer.JavaDeserializationStream.readObject(JavaSerializer.scala:75)
at org.apache.spark.serializer.DeserializationStream$$anon$1.getNext(Serializer.scala:168)
at org.apache.spark.util.NextIterator.hasNext(NextIterator.scala:73)
at org.apache.spark.storage.memory.MemoryStore.putIteratorAsValues(MemoryStore.scala:216)
at org.apache.spark.storage.BlockManager.maybeCacheDiskValuesInMemory(BlockManager.scala:1239)
at org.apache.spark.storage.BlockManager.getLocalValues(BlockManager.scala:550)
at org.apache.spark.storage.BlockManager.getOrElseUpdate(BlockManager.scala:813)
at org.apache.spark.rdd.RDD.getOrCompute(RDD.scala:335)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:286)
at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:324)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:288)
at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:96)
at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:53)
at org.apache.spark.scheduler.Task.run(Task.scala:109)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:345)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

2018-07-02 02:27:13 ERROR TaskSetManager:70 - Task 1 in stage 308.0 failed 1 times; aborting job
2018-07-02 02:27:14 WARN BlockManager:66 - Putting block rdd_1145_0 failed due to exception org.apache.spark.TaskKilledException.
2018-07-02 02:27:14 WARN BlockManager:66 - Block rdd_1145_0 could not be removed as it was not found on disk or in memory

@javeeddanyal
Copy link
Author

Not enough space to cache rdd_1145_1 in memory! It's an rdd long linkage error due to memory overflow in JVM
resolved by using --driver-memory 4G locally

@hongyonggan
Copy link

hi,I also had similar problems.And,The way I solved it was through,Modify creation SparkContext method:
spark=SparkContext(appName="test") # Don't set Master,Set only when submitting a command.
and submit commands:
$SPARK_HOME/bin/spark-submit --master yarn --deploy-master cluster --py-files $path/test.py $params,
You can have a try.If you haven't solved your problem yet,I want you to send out your code and execute commands ,Easy to help you analyze the reasons,thanks!

@ghost
Copy link

ghost commented Sep 17, 2019

Hey,

I am still facing the same issue of connection failure. I am attaching the log of the issue.

ERROR:root:Exception while sending command.
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1159, in send_command
raise Py4JNetworkError("Answer from Java side is empty")
py4j.protocol.Py4JNetworkError: Answer from Java side is empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 985, in send_command
response = connection.send_command(command)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1164, in send_command
"Error while receiving", e, proto.ERROR_ON_RECEIVE)
py4j.protocol.Py4JNetworkError: Error while receiving
Traceback (most recent call last):
File "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python3.5/socketserver.py", line 341, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.5/socketserver.py", line 681, in init
self.handle()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/accumulators.py", line 269, in handle
poll(accum_updates)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/accumulators.py", line 241, in poll
if func():
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/accumulators.py", line 245, in accum_updates
num_updates = read_int(self.rfile)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/serializers.py", line 717, in read_int
raise EOFError
EOFError
ERROR:root:Exception while sending command.
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1159, in send_command
raise Py4JNetworkError("Answer from Java side is empty")
py4j.protocol.Py4JNetworkError: Answer from Java side is empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 985, in send_command
response = connection.send_command(command)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1164, in send_command
"Error while receiving", e, proto.ERROR_ON_RECEIVE)
py4j.protocol.Py4JNetworkError: Error while receiving
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:44098)
Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 19, in
print(df['warn_type2_total',].head(3))
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 1253, in head
return self.take(n)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 572, in take
return self.limit(num).collect()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py", line 534, in collect
sock_info = self._jdf.collectToPython()
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py", line 78, in exit
self._context._jsc.setCallSite(None)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/home/ubuntu/venv/lib/python3.5/site-packages/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o22.setCallSite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value.render_traceback()
AttributeError: 'Py4JError' object has no attribute 'render_traceback'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.5/site-packages/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused

Exception happened during processing of request from ('127.0.0.1', 39990)


Py4JError Traceback (most recent call last)
~/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py in collect(self)
533 with SCCallSiteSync(self._sc) as css:
--> 534 sock_info = self._jdf.collectToPython()
535 return list(_load_from_socket(sock_info, BatchedSerializer(PickleSerializer())))

~/venv/lib/python3.5/site-packages/py4j/java_gateway.py in call(self, *args)
1256 return_value = get_return_value(
-> 1257 answer, self.gateway_client, self.target_id, self.name)
1258

~/venv/lib/python3.5/site-packages/pyspark/sql/utils.py in deco(*a, **kw)
62 try:
---> 63 return f(*a, **kw)
64 except py4j.protocol.Py4JJavaError as e:

~/venv/lib/python3.5/site-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
335 "An error occurred while calling {0}{1}{2}".
--> 336 format(target_id, ".", name))
337 else:

Py4JError: An error occurred while calling o1501.collectToPython

During handling of the above exception, another exception occurred:

Py4JError Traceback (most recent call last)
in
17
18 print(df['warn_type1_total',].head(3))
---> 19 print(df['warn_type2_total',].head(3))

~/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py in head(self, n)
1251 rs = self.head(1)
1252 return rs[0] if rs else None
-> 1253 return self.take(n)
1254
1255 @ignore_unicode_prefix

~/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py in take(self, num)
570 [Row(age=2, name=u'Alice'), Row(age=5, name=u'Bob')]
571 """
--> 572 return self.limit(num).collect()
573
574 @SInCE(1.3)

~/venv/lib/python3.5/site-packages/pyspark/sql/dataframe.py in collect(self)
532 """
533 with SCCallSiteSync(self._sc) as css:
--> 534 sock_info = self._jdf.collectToPython()
535 return list(_load_from_socket(sock_info, BatchedSerializer(PickleSerializer())))
536

~/venv/lib/python3.5/site-packages/pyspark/traceback_utils.py in exit(self, type, value, tb)
76 SCCallSiteSync._spark_stack_depth -= 1
77 if SCCallSiteSync._spark_stack_depth == 0:
---> 78 self._context._jsc.setCallSite(None)

~/venv/lib/python3.5/site-packages/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:

~/venv/lib/python3.5/site-packages/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()

~/venv/lib/python3.5/site-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
334 raise Py4JError(
335 "An error occurred while calling {0}{1}{2}".
--> 336 format(target_id, ".", name))
337 else:
338 type = answer[1]

Py4JError: An error occurred while calling o22.setCallSite

Can anyone help me solving this issue?
Thanks

@kaiseu
Copy link

kaiseu commented Jan 12, 2020

similar issue, can anybody help on this?
ERROR:root:Exception while sending command.
Traceback (most recent call last):
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1159, in send_command
raise Py4JNetworkError("Answer from Java side is empty")
py4j.protocol.Py4JNetworkError: Answer from Java side is empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 985, in send_command
response = connection.send_command(command)
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1164, in send_command
"Error while receiving", e, proto.ERROR_ON_RECEIVE)
py4j.protocol.Py4JNetworkError: Error while receiving
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:41803)
Traceback (most recent call last):
File "/opt/work/spark-2.4.3/python/pyspark/rdd.py", line 816, in collect
sock_info = self.ctx._jvm.PythonRDD.collectAndServe(self._jrdd.rdd())
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/opt/work/spark-2.4.3/python/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:41803)
Traceback (most recent call last):
File "/opt/work/spark-2.4.3/python/pyspark/rdd.py", line 816, in collect
sock_info = self.ctx._jvm.PythonRDD.collectAndServe(self._jrdd.rdd())
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1257, in call
answer, self.gateway_client, self.target_id, self.name)
File "/opt/work/spark-2.4.3/python/pyspark/sql/utils.py", line 63, in deco
return f(*a, **kw)
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/work/spark-2.4.3/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused

@Green-16
Copy link

> hi,I also had similar problems.And,The way I solved it was through,Modify creation SparkContext method:
> `spark=SparkContext(appName="test") # Don't set Master,Set only when submitting a command.`
> and submit commands:
> `$SPARK_HOME/bin/spark-submit --master yarn --deploy-master cluster --py-files $path/test.py $params`,
> You can have a try.If you haven't solved your problem yet,I want you to send out your code and execute commands ,Easy to help you analyze the reasons,thanks!

What you said is very helpful for me .That solved my problem.
Thanks a lot .@hongyonggan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants