-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* sources/hba_reader.c: fix list of keywords It must contain {0,0,0} at the end. Signed-off-by: rkhapov <[email protected]> * context.c: fix warn This patch fixes warnings about writing function pointer into data pointer Signed-off-by: rkhapov <[email protected]> * sources/macro.h: fix warn about signed vs unsiged comparison Signed-off-by: rkhapov <[email protected]> * sources/rules.c: remove unused func Signed-off-by: rkhapov <[email protected]> * sources/counter.c: fix warn About memcpy to volatile variable Signed-off-by: rkhapov <[email protected]> * sources/rules.c: fix warn And remove useless if's Signed-off-by: rkhapov <[email protected]> * sources/rules.c: remove unused var Signed-off-by: rkhapov <[email protected]> * sources/console.c: remove unused vars Signed-off-by: rkhapov <[email protected]> * sources/frontend.c: remove unsed var Signed-off-by: rkhapov <[email protected]> * sources/rules.c: fix warns Signed-off-by: rkhapov <[email protected]> * sources/backend.c: remove unused count From functions od_backend_query*, count arg is not used Signed-off-by: rkhapov <[email protected]> * sources/odyssey.h: add backend_sync To fix warn about implicit declaration of od_backend_request_sync_point Signed-off-by: rkhapov <[email protected]> * sources/address.c: fix implicit inet_pton Signed-off-by: rkhapov <[email protected]> * sources/address.c: fix warn Signed-off-by: rkhapov <[email protected]> * sources/clock.c: fix warn Signed-off-by: rkhapov <[email protected]> * sources/rules.c: fix uninitialized var Signed-off-by: rkhapov <[email protected]> * sources/frontend.c: fix warn Signed-off-by: rkhapov <[email protected]> * sources/scram.c: return instead of free goto in this place will lead to free on unitialized ptr Signed-off-by: rkhapov <[email protected]> * sources/scram.c: fix warn Case when size + 1 >= INT_MAX is extremely unlikely Signed-off-by: rkhapov <[email protected]> * test/odyssey: use test macro instead of assert More informative + do not produce warnings Signed-off-by: rkhapov <[email protected]> * thread.c: fix warn about implicit func Signed-off-by: rkhapov <[email protected]> * docker/bin/ody-stop: SIGTERM wait This is more useful for tests: will help to find out if gracefully termination in odyssey doestn't work. Signed-off-by: rkhapov <[email protected]> * docker/Dockerfile: update libasan This will possibly fix infinite DEADLYSIGNAL error Signed-off-by: rkhapov <[email protected]> * docker/entrypoint.sh: disable addr randomization There is some bug with asan we currently using This bug leads to infinite DEADLYSIGNAL message on odyssey-asan runs sometimes This patch adds some simple workaround about it Signed-off-by: rkhapov <[email protected]> * soureces/hba.c: fix reloading It was broken, because it sets new rules list at the stack. Signed-off-by: rkhapov <[email protected]> * sources/rules.c: fix router closing It should be closed after every usage. This patch moves closing after every logging, otherwise there will be use-after-free. Signed-off-by: rkhapov <[email protected]> --------- Signed-off-by: rkhapov <[email protected]> Co-authored-by: rkhapov <[email protected]>
- Loading branch information
Showing
26 changed files
with
224 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,62 @@ | ||
#!/bin/bash | ||
pkill odyssey || (sleep 1 && kill -9 $(pgrep odyssey)) || true | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import time | ||
import signal | ||
import subprocess | ||
|
||
|
||
def get_odyssey_pids(): | ||
print(subprocess.check_output('ps aux | grep odyssey', shell=True).decode('utf-8')) | ||
|
||
try: | ||
return list(map(int, subprocess.check_output(['pgrep', 'odyssey']).split())) | ||
except subprocess.CalledProcessError: | ||
# non-zero exit code means that there is no odyssey pids | ||
return [] | ||
|
||
def terminate_gracefully(pid, timeout): | ||
try: | ||
os.kill(pid, signal.SIGTERM) | ||
except ProcessLookupError: | ||
print(f'Process {pid} already finished or doesnt ever existed') | ||
return | ||
|
||
print(f'Waiting {timeout} seconds to {pid} finish after SIGTERM...', end='') | ||
|
||
start = time.time() | ||
finished = False | ||
|
||
while time.time() - start < timeout: | ||
try: | ||
if 'odyssey'.encode('utf-8') not in subprocess.check_output(['ps', '-p', str(pid)], ): | ||
finished = True | ||
break | ||
except subprocess.CalledProcessError: | ||
# non-zero code means there is no process with that pid | ||
finished = True | ||
break | ||
|
||
print('.', end='') | ||
time.sleep(0.5) | ||
|
||
print() | ||
|
||
return finished | ||
|
||
|
||
def main(): | ||
timeout = 5 | ||
|
||
pids = get_odyssey_pids() | ||
print('Found odyssey pids:', ', '.join(list(map(str, pids)))) | ||
|
||
for pid in pids: | ||
if not terminate_gracefully(pid, timeout): | ||
print(f'Process {pid} didnt finish within {timeout} seconds') | ||
exit(1) | ||
|
||
exit(0) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.