Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/659c9161ee037bb523891ac3e3b00748cec6289f
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/659c9161ee037bb523891ac3e3b00748cec6289f
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/659c9161ee037bb523891ac3e3b00748cec6289f

The branch, master has been updated
       via  659c9161ee037bb523891ac3e3b00748cec6289f (commit)
       via  09fa61eb737aa93fb2e99d383c46bcf35d5d730d (commit)
       via  1d5a024a68be4ce6558eeffacb8ef6fb5f5a1417 (commit)
      from  5c0eee43e2965d1e8b34b5a7b275de308cc09cc1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=659c9161ee037bb523891ac3e3b00748cec6289f
commit 659c9161ee037bb523891ac3e3b00748cec6289f
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>

    llcache: Abort cleanly if called back during shutdown
    
    In order to help us debug shutting down with active fetches, this
    will abort the process cleanly if we get a callback to an "active"
    llcache handle after the abort process has actually killed them
    all.  This can happen with deferred fetcher aborts in the cURL
    fetcher.
    
    Signed-off-by: Daniel Silverstone <[email protected]>

diff --git a/content/llcache.c b/content/llcache.c
index 58ac00a..625e810 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2762,6 +2762,13 @@ static void llcache_fetch_callback(const fetch_msg *msg, 
void *p)
        llcache_object *object = p;
        llcache_event event;
 
+       if (llcache == NULL) {
+               NSLOG(llcache, CRITICAL, "Callback happened after llcache 
finalisation");
+               assert(false);
+               /* In case assertions are off, return here */
+               return;
+       }
+
        NSLOG(llcache, DEBUG, "Fetch event %d for %p", msg->type, object);
 
        switch (msg->type) {


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=09fa61eb737aa93fb2e99d383c46bcf35d5d730d
commit 09fa61eb737aa93fb2e99d383c46bcf35d5d730d
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>

    hlcache.c: Clean up LOADING contents during finalise
    
    During the process of finalising the hlcache, there won't be
    any more fetching going on.  As such, we can abort, error, and
    then destroy any contents still in the process of loading.  This
    should reduce our leaks during shutdown.
    
    Signed-off-by: Daniel Silverstone <[email protected]>

diff --git a/content/hlcache.c b/content/hlcache.c
index 33436f7..61cdebe 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -36,6 +36,8 @@
 
 #include "content/mimesniff.h"
 #include "content/hlcache.h"
+// Note, this is *ONLY* so that we can abort cleanly during shutdown of the 
cache
+#include "content/content_protected.h"
 
 typedef struct hlcache_entry hlcache_entry;
 typedef struct hlcache_retrieval_ctx hlcache_retrieval_ctx;
@@ -104,9 +106,10 @@ static struct hlcache_s *hlcache = NULL;
 /**
  * Attempt to clean the cache
  */
-static void hlcache_clean(void *ignored)
+static void hlcache_clean(void *force_clean_flag)
 {
        hlcache_entry *entry, *next;
+       bool force_clean = (force_clean_flag != NULL);
 
        for (entry = hlcache->content_list; entry != NULL; entry = next) {
                next = entry->next;
@@ -114,12 +117,17 @@ static void hlcache_clean(void *ignored)
                if (entry->content == NULL)
                        continue;
 
-               if (content__get_status(entry->content) == 
CONTENT_STATUS_LOADING)
-                       continue;
-
                if (content_count_users(entry->content) != 0)
                        continue;
 
+               if (content__get_status(entry->content) == 
CONTENT_STATUS_LOADING) {
+                       if (force_clean == false)
+                               continue;
+                       NSLOG(netsurf, DEBUG, "Forcing content cleanup during 
shutdown");
+                       content_abort(entry->content);
+                       content_set_error(entry->content);
+               }
+
                /** \todo This is over-zealous: all unused contents
                 * will be immediately destroyed. Ideally, we want to
                 * purge all unused contents that are using stale
@@ -581,6 +589,20 @@ void hlcache_finalise(void)
                }
        } while (num_contents > 0 && num_contents != prev_contents);
 
+       NSLOG(netsurf, INFO, "%d contents remaining after being polite", 
num_contents);
+
+       /* Drain cache again, forcing the matter */
+       do {
+               prev_contents = num_contents;
+
+               hlcache_clean(&entry); // Any non-NULL pointer will do
+
+               for (num_contents = 0, entry = hlcache->content_list;
+                               entry != NULL; entry = entry->next) {
+                       num_contents++;
+               }
+       } while (num_contents > 0 && num_contents != prev_contents);
+
        NSLOG(netsurf, INFO, "%d contents remaining:", num_contents);
        for (entry = hlcache->content_list; entry != NULL; entry = entry->next) 
{
                hlcache_handle entry_handle = { entry, NULL, NULL };


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=1d5a024a68be4ce6558eeffacb8ef6fb5f5a1417
commit 1d5a024a68be4ce6558eeffacb8ef6fb5f5a1417
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>

    Sleepy JS test, handy to alt+f4 during load to check shutdown
    
    Signed-off-by: Daniel Silverstone <[email protected]>

diff --git a/test/js/sleepy-async.html b/test/js/sleepy-async.html
new file mode 100644
index 0000000..b94997f
--- /dev/null
+++ b/test/js/sleepy-async.html
@@ -0,0 +1,13 @@
+<html>
+  <head>
+    <title>
+      Async sleepy script
+    </title>
+  </head>
+  <body>
+    This page is loading a sleepy async script.
+
+    Do not expect it to do anything useful.
+    <script src="https://test.netsurf-browser.org/cgi-bin/sleep.cgi"; 
type="text/javascript" async></script>
+  </body>
+</html>


-----------------------------------------------------------------------

Summary of changes:
 content/hlcache.c         |   30 ++++++++++++++++++++++++++----
 content/llcache.c         |    7 +++++++
 test/js/sleepy-async.html |   13 +++++++++++++
 3 files changed, 46 insertions(+), 4 deletions(-)
 create mode 100644 test/js/sleepy-async.html

diff --git a/content/hlcache.c b/content/hlcache.c
index 33436f7..61cdebe 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -36,6 +36,8 @@
 
 #include "content/mimesniff.h"
 #include "content/hlcache.h"
+// Note, this is *ONLY* so that we can abort cleanly during shutdown of the 
cache
+#include "content/content_protected.h"
 
 typedef struct hlcache_entry hlcache_entry;
 typedef struct hlcache_retrieval_ctx hlcache_retrieval_ctx;
@@ -104,9 +106,10 @@ static struct hlcache_s *hlcache = NULL;
 /**
  * Attempt to clean the cache
  */
-static void hlcache_clean(void *ignored)
+static void hlcache_clean(void *force_clean_flag)
 {
        hlcache_entry *entry, *next;
+       bool force_clean = (force_clean_flag != NULL);
 
        for (entry = hlcache->content_list; entry != NULL; entry = next) {
                next = entry->next;
@@ -114,12 +117,17 @@ static void hlcache_clean(void *ignored)
                if (entry->content == NULL)
                        continue;
 
-               if (content__get_status(entry->content) == 
CONTENT_STATUS_LOADING)
-                       continue;
-
                if (content_count_users(entry->content) != 0)
                        continue;
 
+               if (content__get_status(entry->content) == 
CONTENT_STATUS_LOADING) {
+                       if (force_clean == false)
+                               continue;
+                       NSLOG(netsurf, DEBUG, "Forcing content cleanup during 
shutdown");
+                       content_abort(entry->content);
+                       content_set_error(entry->content);
+               }
+
                /** \todo This is over-zealous: all unused contents
                 * will be immediately destroyed. Ideally, we want to
                 * purge all unused contents that are using stale
@@ -581,6 +589,20 @@ void hlcache_finalise(void)
                }
        } while (num_contents > 0 && num_contents != prev_contents);
 
+       NSLOG(netsurf, INFO, "%d contents remaining after being polite", 
num_contents);
+
+       /* Drain cache again, forcing the matter */
+       do {
+               prev_contents = num_contents;
+
+               hlcache_clean(&entry); // Any non-NULL pointer will do
+
+               for (num_contents = 0, entry = hlcache->content_list;
+                               entry != NULL; entry = entry->next) {
+                       num_contents++;
+               }
+       } while (num_contents > 0 && num_contents != prev_contents);
+
        NSLOG(netsurf, INFO, "%d contents remaining:", num_contents);
        for (entry = hlcache->content_list; entry != NULL; entry = entry->next) 
{
                hlcache_handle entry_handle = { entry, NULL, NULL };
diff --git a/content/llcache.c b/content/llcache.c
index 58ac00a..625e810 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2762,6 +2762,13 @@ static void llcache_fetch_callback(const fetch_msg *msg, 
void *p)
        llcache_object *object = p;
        llcache_event event;
 
+       if (llcache == NULL) {
+               NSLOG(llcache, CRITICAL, "Callback happened after llcache 
finalisation");
+               assert(false);
+               /* In case assertions are off, return here */
+               return;
+       }
+
        NSLOG(llcache, DEBUG, "Fetch event %d for %p", msg->type, object);
 
        switch (msg->type) {
diff --git a/test/js/sleepy-async.html b/test/js/sleepy-async.html
new file mode 100644
index 0000000..b94997f
--- /dev/null
+++ b/test/js/sleepy-async.html
@@ -0,0 +1,13 @@
+<html>
+  <head>
+    <title>
+      Async sleepy script
+    </title>
+  </head>
+  <body>
+    This page is loading a sleepy async script.
+
+    Do not expect it to do anything useful.
+    <script src="https://test.netsurf-browser.org/cgi-bin/sleep.cgi"; 
type="text/javascript" async></script>
+  </body>
+</html>


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to