Skip to content

Commit 6b51317

Browse files
aijamysutedja
authored andcommitted
Fix extra chunks being sent for large chunks
Previously, when an external command used the SCPv2 (chunked=true) protocol via splunklib and returned with 50,000 or more rows for one chunk, it would send two replies intead of one. This caused the external command to get out of sync, sending chunk replies before reading the corresponding request. Fixes #150
1 parent 3e0c6f1 commit 6b51317

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

splunklib/searchcommands/internals.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,11 @@ def flush(self, finished=None, partial=None):
750750
RecordWriter.flush(self, finished, partial) # validates arguments and the state of this instance
751751
inspector = self._inspector
752752

753+
if partial:
754+
# Don't flush partial chunks, since the SCP v2 protocol does not
755+
# provide a way to send partial chunks yet.
756+
return
757+
753758
if self._flushed is False:
754759

755760
self._total_record_count += self._record_count

splunklib/searchcommands/search_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def flush(self):
398398
:return: :const:`None`
399399
400400
"""
401-
self._record_writer.flush(partial=True)
401+
self._record_writer.flush(finished=False)
402402

403403
def prepare(self):
404404
""" Prepare for execution.

0 commit comments

Comments
 (0)