12
12
from plaso .engine import zeromq_queue
13
13
from plaso .lib import bufferlib
14
14
from plaso .lib import definitions
15
+ from plaso .lib import errors
15
16
from plaso .multi_processing import analysis_process
16
17
from plaso .multi_processing import engine as multi_process_engine
17
18
from plaso .multi_processing import logger
@@ -916,7 +917,9 @@ def AnalyzeEvents(
916
917
if not analysis_plugins :
917
918
return
918
919
920
+ abort_kill = False
919
921
keyboard_interrupt = False
922
+ queue_full = False
920
923
921
924
self ._analysis_plugins = {}
922
925
self ._data_location = data_location
@@ -952,15 +955,20 @@ def AnalyzeEvents(
952
955
953
956
self ._status = definitions .STATUS_INDICATOR_FINALIZING
954
957
958
+ except errors .QueueFull :
959
+ queue_full = True
960
+ self ._abort = True
961
+
955
962
except KeyboardInterrupt :
956
963
keyboard_interrupt = True
957
964
self ._abort = True
958
965
959
- self ._processing_status .aborted = True
960
- if self ._status_update_callback :
961
- self ._status_update_callback (self ._processing_status )
962
-
963
966
finally :
967
+ if self ._abort :
968
+ self ._processing_status .aborted = True
969
+ if self ._status_update_callback :
970
+ self ._status_update_callback (self ._processing_status )
971
+
964
972
storage_writer .WriteSessionCompletion (aborted = self ._abort )
965
973
966
974
storage_writer .Close ()
@@ -970,12 +978,18 @@ def AnalyzeEvents(
970
978
# so we include the storage sync to disk in the status updates.
971
979
self ._StopStatusUpdateThread ()
972
980
973
- try :
974
- self ._StopAnalysisProcesses (abort = self ._abort )
981
+ if queue_full :
982
+ # TODO: handle abort on queue full more elegant.
983
+ abort_kill = True
984
+ else :
985
+ try :
986
+ self ._StopAnalysisProcesses (abort = self ._abort )
975
987
976
- except KeyboardInterrupt :
977
- keyboard_interrupt = True
988
+ except KeyboardInterrupt :
989
+ keyboard_interrupt = True
990
+ abort_kill = True
978
991
992
+ if abort_kill :
979
993
self ._AbortKill ()
980
994
981
995
# The abort can leave the main process unresponsive
0 commit comments