Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions python/pyspark/errors/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,11 @@
"Argument <arg_name> must be a numerical column for plotting, got <arg_type>."
]
},
"PROTOCOL_ERROR": {
"message": [
"<failure>. This usually indicates that the message does not conform to the protocol."
]
},
"PYTHON_HASH_SEED_NOT_SET": {
"message": [
"Randomness of hash of string should be disabled via PYTHONHASHSEED."
Expand Down
14 changes: 13 additions & 1 deletion python/pyspark/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,19 @@ def __init__(self, infile=None):

def load(self, infile):
num_conf = read_int(infile)
for i in range(num_conf):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a bit of background here in a comment. I was also wondering why we need this as we're already controlling the confs to send.

# We do a sanity check here to reduce the possibility to stuck indefinitely
# due to an invalid messsage. If the numer of configurations is obviously
# wrong, we just raise an error directly.
# We hand-pick the configurations to send to the worker so the number should
# be very small (less than 100).
if num_conf < 0 or num_conf > 10000:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10,000 seems to be too small though, @gaogaotiantian .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, don't we already only send the allowed confs only? e.g., ArrowPythonRunner.getPythonRunnerConfMap

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay so this is adding a sanity check

raise PySparkRuntimeError(
errorClass="PROTOCOL_ERROR",
messageParameters={
"failure": f"Invalid number of configurations: {num_conf}",
},
)
for _ in range(num_conf):
k = utf8_deserializer.loads(infile)
v = utf8_deserializer.loads(infile)
self._conf[k] = v
Expand Down