[hunchentoot-devel] Strange race condition?

John Thingstad john.thingstad at chello.no
Sat Aug 18 07:17:07 UTC 2007


I have just written a blog program.
Functionally it is complete, but it contains a big and serious flaw.
At intermittent intervals it gives a error like:

[2007-08-18 09:05:58 [ERROR]] While accessing database  
#<CLSQL-MYSQL:MYSQL-DATAB
ASE localhost/blog/jthing OPEN 219A8C6F>
   with expression "SELECT * FROM BLOG_ITEMS WHERE (ID = 224)":
   Error 2006 / MySQL server has gone away
   has occurred.

It seems like a clsql error.. So why am I reporting it to here?

Well the first thing to do is to isolate what is causing the error.
After eliminating that the error was in my code (which included a rewrite)  
I found it down to the following lines:

     (with-html-output-to-string
         (*standard-output* nil :prologue t :indent t)
       (:html :xmlns "http://www.w3.org/1999/xhtml"
        (:head
         (:title (fmt "~A - ~A"
                      (escape-string (getf blog :title))
                      (escape-string (getf item :title))))
         (:link :href *blog-css-file*
          :rel "stylesheet" :type "text/css")
         (:link :href *tree-css-file*
          :rel "stylesheet" :type "text/css"
          :media "screen, projection")
         (:script :type "text/javascript" :src *tree-js-file* "")
         (:script :type "text/javascript"
          (fmt "~%addLoadListener( function() { treeMenu('~A', '~A'); });"
               "navigation"
               (format nil "~A?id=~D"
                       (script-name)
                       item-id))))

So it should be reported to cl-who right. Wrong!
The problem isn't in the code that is generated.
It appers to be the fact that I am including 2 css files and a javascript  
file.
It is the UPLOAD of these from the client and the inerruption of the  
thread that causes the problem.
Has anyone here experienced anything simular?



More information about the Tbnl-devel mailing list