Project

General

Profile

Bug #1477

Input doesn't restart properly

Added by Luke Murphey about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
09/12/2016
Due date:
% Done:

100%


Description

The socket doesn't get closed until data hits the socket. The input cannot run because the socket is in use.

2016-09-12 05:17:57,404 ERROR Execution failed
Traceback (most recent call last):
  File "/opt/splunk/etc/apps/webhooks_input/bin/webhooks_input_app/modular_input.py", line 1328, in execute
    self.do_run(in_stream, log_exception_and_continue=True)
  File "/opt/splunk/etc/apps/webhooks_input/bin/webhooks_input_app/modular_input.py", line 1228, in do_run
    input_config)
  File "/opt/splunk/etc/apps/webhooks_input/bin/webhooks_input.py", line 189, in run
    httpd = WebServer(output_results, port, path_re, logger=self.logger)
  File "/opt/splunk/etc/apps/webhooks_input/bin/webhooks_input.py", line 98, in __init__
    server = HTTPServer(('', port), LogRequestsInSplunkHandler)
  File "/opt/splunk/lib/python2.7/SocketServer.py", line 420, in __init__
    self.server_bind()
  File "/opt/splunk/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/opt/splunk/lib/python2.7/SocketServer.py", line 434, in server_bind
    self.socket.bind(self.server_address)
  File "/opt/splunk/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 98] Address already in use

History

#1 Updated by Luke Murphey about 8 years ago

I wish I could find a good way to set the default interval to something like 5 seconds. Setting the interval in the [default] stanza doesn't seem to work.

#2 Updated by Luke Murphey about 8 years ago

https://engineering.imvu.com/2014/03/06/charming-python-how-to-actually-close-a-socket-by-calling-shutdown-before-calling-close/

"The conclusion is that Python sockets should always be closed by first calling shutdown() and then calling close()."

http://stackoverflow.com/questions/5040491/python-socket-doesnt-close-connection-properly

" Even though you've closed your socket, it still has lingering consequences for a couple minutes. The reasons for this, as well as a socket flag you can set to disable the behavior (SO_REUSEADDR), are explained in the UNIX guide socket FAQ."

#3 Updated by Luke Murphey about 8 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF