Skip to content

Fix handling of exceptions when osquery goes away #83

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

Merged
merged 2 commits into from
Apr 15, 2022
Merged
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
17 changes: 13 additions & 4 deletions osquery/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,21 @@ def start_watcher(client, interval):
while True:
status = client.extension_manager_client().ping()
if status.code != 0:
logging.error("Ping received nonzero status: %d", status)
break
time.sleep(interval)
except socket.error:
# The socket was torn down.
pass
os._exit(0)

except socket.error as e:
logging.error("Ping received socket.error: %s", e)

except TTransport.TTransportException as e:
logging.error("Ping received thrift.transport.TTransport.TTransportException: %s", e)

except Exception as e:
logging.error("Ping received unknown exception: %s", e)

finally:
os._exit(1)


def start_extension(name="<unknown>",
Expand Down