about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-15 23:37:40 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-16 00:14:42 -0700
commit8d3b25a8e43a151f3edf9baf3346d0a069a7be46 (patch)
tree17a7e125a1f95bf737001d6960f3c1de4f8fe36a
parentd51c9c2f5451bad813e5f291443f237d52856358 (diff)
downloadmu-8d3b25a8e43a151f3edf9baf3346d0a069a7be46.tar.gz
3190
I'm seeing *extremely* rare crashes due to some problem with negative
refcounts in the edit/ app. It's not using any concurrency at all, so
that's not the issue. Setting a tripwire to try and catch it. I'm going
to run:

  mu --trace edit

..all the time for a while. And periodically restart when the trace
makes the program too sluggish to continue.
-rw-r--r--036refcount.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/036refcount.cc b/036refcount.cc
index e1954cc8..638aed24 100644
--- a/036refcount.cc
+++ b/036refcount.cc
@@ -53,8 +53,13 @@ void update_refcounts(int old_address, int new_address, const type_tree* payload
     put(Memory, old_address, old_refcount);
     if (old_refcount < 0) {
       tb_shutdown();
-      DUMP("");
-      cerr << "Negative refcount: " << old_address << ' ' << old_refcount << '\n';
+      cerr << "Negative refcount!!! " << old_address << ' ' << old_refcount << '\n';
+      if (Trace_stream) {
+        cerr << "Saving trace to last_trace.\n";
+        ofstream fout("last_trace");
+        fout << Trace_stream->readable_contents("");
+        fout.close();
+      }
       exit(0);
     }
     // End Decrement Reference Count(old_address, payload_type, payload_size)