diff --git a/include/class.thread.php b/include/class.thread.php
index decd0db5f8641e6f5e87dfb8f35ed40f5ba9e31f..c69eb28549412bd25454a24f7df97334299331aa 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -1272,6 +1272,11 @@ class ThreadBody /* extends SplString */ {
         if (!in_array($type, static::$types))
             throw new Exception($type.': Unsupported ThreadBody type');
         $this->body = (string) $body;
+        if (strlen($this->body) > 250000) {
+            $max_packet = db_get_variable('max_allowed_packet', 'global');
+            // Truncate just short of the max_allowed_packet
+            $this->body = substr($this->body, $max_packet - 2048) . ' ... (truncated)';
+        }
         $this->type = $type;
         $this->options = array_merge($this->options, $options);
     }