Uploaded image for project: 'Immutant'
  1. Immutant
  2. IMMUTANT-193

file-store session persistence not working

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Partially Completed
    • Affects Version/s: 0.7.0
    • Fix Version/s: 0.8.0
    • Labels:
      None
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Here's how to make it work: look for the cache-container named web within $IMMUTANT_HOME/jboss/standalone/configuration/standalone-ha.xml. Inside that element is a replicated-cache element. Replace its file-store element with this:

      <file-store preload="true" passivation="false" purge="false"/>
      

      Show
      Here's how to make it work: look for the cache-container named web within $IMMUTANT_HOME/jboss/standalone/configuration/standalone-ha.xml . Inside that element is a replicated-cache element. Replace its file-store element with this: < file -store preload = "true" passivation = "false" purge = "false" />

      Description

      Based on IRC chat, the expectation is that session should be persisted to disk when an app is redeployed in clustered mode.

      sample immutant/init.clj: (project called "sessiontest")

      (ns immutant.init
        (:require [immutant.messaging :as messaging]
                  [immutant.web :as web]
                  [ring.middleware.session :as ring-session]
                  [immutant.web.session :as session]
                  [immutant.util :as util]))
       
      (defn counter
        [request]
        (let [counter (if-let [counter (-> request :session :counter)]
                        (+ counter 1)
                        1)]
          (println "REQUEST" request)
          {:status 200
           :headers {"Content-Type" "text/html"}
           :body (str "counter is " counter)
           :session {:counter counter}}))
       
      (web/start "/" (ring-session/wrap-session counter
                                  {:store (session/servlet-store)}))
      

      example session:

      $ curl http://localhost:8080/sessiontest
      counter is 1
      $ curl http://localhost:8080/sessiontest
      counter is 1
      $ curl http://localhost:8080/sessiontest -b cookiejar -c cookiejar
      counter is 1
      $ curl http://localhost:8080/sessiontest -b cookiejar -c cookiejar
      counter is 2
      $ curl http://localhost:8080/sessiontest -b cookiejar -c cookiejar
      counter is 3
      $ curl http://localhost:8080/sessiontest -b cookiejar -c cookiejar
      counter is 4

      session is clearly maintained when cookies are provide

      app is redeployed using "lein immutant deploy", log shows nothing saved to disk:

      14:47:03,393 INFO [org.infinispan.eviction.PassivationManagerImpl] (MSC service thread 1-15) ISPN000029: Passivating all entries to disk
      14:47:03,393 INFO [org.infinispan.eviction.PassivationManagerImpl] (MSC service thread 1-15) ISPN000030: Passivated 0 entries in 0 milliseconds

      And session is not maintained

      $ curl http://localhost:8080/sessiontest -b cookiejar -c cookiejar
      counter is 1

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jcrossley Jim Crossley
                Reporter:
                norman Norman Richards
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: