splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

Error on pull and push records to splunk

Open liketic opened this issue 10 years ago • 4 comments

Suppose I have 300 million events in my local Splunk instance. I write a chunked streaming search command read records from Splunk and write to Splunk then. Then I got a error: ChunkedExternProcessor - Failure writing result chunk, buffer full. External process possibly failed to read its stdin.

Seems it's a very common issue when handling big scale data. Maybe it's a bug?

Another issue is when I write a big data to Splunk, I can also get this exception sometime:

File=search_command.py, Line=1016, IOError at "/Applications/Splunk/etc/apps/searchcommands_app/bin/packages/splunklib/searchcommands/internals.py", line 820 : [Errno 32] Broken pipe
Traceback:
  File "/Applications/Splunk/etc/apps/searchcommands_app/bin/packages/splunklib/searchcommands/search_command.py", line 801, in _process_protocol_v2
    self._execute(ifile, None)
  File "/Applications/Splunk/etc/apps/searchcommands_app/bin/packages/splunklib/searchcommands/streaming_command.py", line 54, in _execute
    SearchCommand._execute(self, ifile, self.stream)
  File "/Applications/Splunk/etc/apps/searchcommands_app/bin/packages/splunklib/searchcommands/search_command.py", line 869, in _execute
    self._record_writer.write_records(process(self._records(ifile)))
  File "/Applications/Splunk/etc/apps/searchcommands_app/bin/packages/splunklib/searchcommands/internals.py", line 528, in write_records
    write_record(record)
  File "/Applications/Splunk/etc/apps/searchcommands_app/bin/packages/splunklib/searchcommands/internals.py", line 651, in _write_record
    self.flush(partial=True)
  File "/Applications/Splunk/etc/apps/searchcommands_app/bin/packages/splunklib/searchcommands/internals.py", line 774, in flush
    self._write_chunk(metadata, self._buffer.getvalue())
  File "/Applications/Splunk/etc/apps/searchcommands_app/bin/packages/splunklib/searchcommands/internals.py", line 820, in _write_chunk
    write(body)

I think maybe you guys want to know this.

liketic avatar Aug 02 '16 07:08 liketic

Running into this problem as well. Is there any known workaround (like maybe not using chunked)?

geekusa avatar Jun 08 '18 14:06 geekusa

Is there any workaround for this? Or plan to be fixed?

Cavalierski avatar Dec 14 '18 01:12 Cavalierski

Hey devs, any updates on this one? Just making sure I should use this wrapper at all (issue dating Aug 2016 and still not fixed).

ddnomad avatar Dec 17 '18 17:12 ddnomad

This issue is discussed in Splunk Answers ticket 686940 (https://answers.splunk.com/answers/686940) and I have offered a proposed SDK-side workaround (that is actually also an SDK efficiency improvement) in GitHub here: https://github.com/TiVo/splunk-sdk-python/commit/5188f7d709cadd80e786692b371a64c4ae0991d2

kulick avatar Aug 08 '19 00:08 kulick