]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Log events on forced timeout
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 27 Dec 2021 18:45:43 +0000 (18:45 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 27 Dec 2021 18:45:43 +0000 (18:45 +0000)
src/libserver/async_session.c
src/libserver/async_session.h
src/libserver/task.c

index 057604447fd9389aa04b55dd94f2e00a29a3ab76..f84b8aa5eadedb573947964a1971b7e2a7c85bdd 100644 (file)
@@ -257,7 +257,7 @@ rspamd_session_destroy (struct rspamd_async_session *session)
 
        if (!rspamd_session_blocked (session)) {
                session->flags |= RSPAMD_SESSION_FLAG_DESTROYING;
-               rspamd_session_cleanup (session);
+               rspamd_session_cleanup (session, false);
 
                if (session->cleanup != NULL) {
                        session->cleanup (session->user_data);
@@ -268,7 +268,7 @@ rspamd_session_destroy (struct rspamd_async_session *session)
 }
 
 void
-rspamd_session_cleanup (struct rspamd_async_session *session)
+rspamd_session_cleanup (struct rspamd_async_session *session, bool forced_cleanup)
 {
        struct rspamd_async_event *ev;
 
@@ -285,15 +285,32 @@ rspamd_session_cleanup (struct rspamd_async_session *session)
                int ret;
 
                if (ev->fin != NULL) {
-                       msg_debug_session ("removed event on destroy: %p, subsystem: %s",
-                                       ev->user_data,
-                                       ev->subsystem);
+                       if (forced_cleanup) {
+                               msg_info_session ("forced removed event on destroy: %p, subsystem: %s, scheduled from: %s",
+                                               ev->user_data,
+                                               ev->subsystem,
+                                               ev->loc);
+                       }
+                       else {
+                               msg_debug_session("removed event on destroy: %p, subsystem: %s",
+                                               ev->user_data,
+                                               ev->subsystem);
+                       }
                        ev->fin (ev->user_data);
                }
                else {
-                       msg_debug_session ("NOT removed event on destroy - uncancellable: %p, subsystem: %s",
-                                       ev->user_data,
-                                       ev->subsystem);
+                       if (forced_cleanup) {
+                               msg_info_session ("NOT forced removed event on destroy - uncancellable: "
+                                                                 "%p, subsystem: %s, scheduled from: %s",
+                                               ev->user_data,
+                                               ev->subsystem,
+                                               ev->loc);
+                       }
+                       else {
+                               msg_debug_session("NOT removed event on destroy - uncancellable: %p, subsystem: %s",
+                                               ev->user_data,
+                                               ev->subsystem);
+                       }
                        /* Assume an event is uncancellable, move it to a new hash table */
                        kh_put (rspamd_events_hash, uncancellable_events, ev, &ret);
                }
@@ -301,7 +318,13 @@ rspamd_session_cleanup (struct rspamd_async_session *session)
 
        kh_destroy (rspamd_events_hash, session->events);
        session->events = uncancellable_events;
-       msg_debug_session ("pending %d uncancellable events", kh_size (uncancellable_events));
+       if (forced_cleanup) {
+               msg_info_session ("pending %d uncancellable events", kh_size (uncancellable_events));
+       }
+       else {
+               msg_debug_session ("pending %d uncancellable events", kh_size (uncancellable_events));
+       }
+
        session->flags &= ~RSPAMD_SESSION_FLAG_CLEANUP;
 }
 
index ad79769e98f2349c9c228aaa28c68356e0c2dc33..5dc4a3b847e2a9cd7c657f845622fea263eb0c6d 100644 (file)
@@ -83,7 +83,7 @@ gboolean rspamd_session_destroy (struct rspamd_async_session *session);
 /**
  * Try to remove all events pending
  */
-void rspamd_session_cleanup (struct rspamd_async_session *session);
+void rspamd_session_cleanup (struct rspamd_async_session *session, bool forced_cleanup);
 
 /**
  * Returns mempool associated with async session
index c9f3fb627a6b5324afbaafe7da887c5a39cde01c..fa97d67a5cc713e9620d21864e2db566ec58e164 100644 (file)
@@ -1911,7 +1911,7 @@ rspamd_task_timeout (EV_P_ ev_timer *w, int revents)
 
                ev_timer_again (EV_A_ w);
                task->processed_stages |= RSPAMD_TASK_STAGE_FILTERS;
-               rspamd_session_cleanup (task->s);
+               rspamd_session_cleanup (task->s, true);
                rspamd_task_process (task, RSPAMD_TASK_PROCESS_ALL);
                rspamd_session_pending (task->s);
        }
@@ -1940,7 +1940,7 @@ rspamd_task_timeout (EV_P_ ev_timer *w, int revents)
 
                ev_timer_stop (EV_A_ w);
                task->processed_stages |= RSPAMD_TASK_STAGE_DONE;
-               rspamd_session_cleanup (task->s);
+               rspamd_session_cleanup (task->s, true);
                rspamd_task_process (task, RSPAMD_TASK_PROCESS_ALL);
                rspamd_session_pending (task->s);
        }