Skip to content

Commit 643d4db

Browse files
committed
[FIX] server: close server if communication is pipe is broken
Actually if the server is left alone (should not happen, but still), the communication is broken, and it starts to log that he can't communicate, then crash, then log, etc... This commit ensure that it doesn't happen and choose to close the server if the communication pipe is broken. This behaviour could be fine-tuned if the server appear to be used independently for multiple client (?)
1 parent cf12aa7 commit 643d4db

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/python_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ def wrapper_func(*args, **kwargs):
214214
try:
215215
return func(*args, **kwargs)
216216
except Exception:
217-
odoo_server.show_message_log(traceback.format_exc(), MessageType.Error)
218-
odoo_server.send_notification("Odoo/displayCrashNotification", {"crashInfo": traceback.format_exc()})
217+
try:
218+
odoo_server.show_message_log(traceback.format_exc(), MessageType.Error)
219+
odoo_server.send_notification("Odoo/displayCrashNotification", {"crashInfo": traceback.format_exc()})
220+
except Exception:
221+
#it was the last chance... We prefer to close the server here as it seems there is an issue with the communication
222+
exit(1)
219223
return wrapper_func

0 commit comments

Comments
 (0)