[mod_python] For what session locking is? Do i need it while using MySQL?

Norman Tindall NormanTindall at zdisk.net
Thu Aug 10 15:57:54 EDT 2006


Hello Jim,

      I describe you the session locking mechanizm as i see,
      correct me if i am wrong.

      As to lock subroutine in _apache we passing:
      1 - server object
      2 - session_id
      From this i can tell that in fact locked session_ids (session
      data locked indirect)

      +----------------------------------------------+---------------------+
      |  session_id                       |  status  | serv that aq  lock  |
      +----------------------------------------------+---------------------+
      |  5540fda192a40b4acd084decdb6f66ed |  locked  | thread 1 server id
      |  9ec0c48867bff638b7a790c314ed52ff |  locked  | thread 4 server id
      |  .. .. .. .. .. .. .. .. .. .. .. .. .... .... .... .... ..
      +-------------------------------------------------------------------
          ^     |            ^           |                 ^      |
   1)Lock |     |            | 4)Lock    |         7)Lock  |      |
          | 3)release        |           |                 |  9) release
          |     |            |    6)release                |      |
      +-----------+    +--------------------+        +----------------
      | thread 1  |    | thread 2           |        | thread 3 also
      +-----------+    +-----------                   trying to aquire
      | aquired lock   | trying to
        on 5540fd..      aquire lock on                          |
        sess_id          5540fd.. but blocked                    |
                         until thread 1 releases lock            | 8) write
               |                \   5) Write                     |
     2) Write  |     +--------------------------------------+    |
               ----->|  session data (in file or mysql)     | <---
                     +--------------------------------------+

       Thread 1 locking sess_id, making manipulation with session
       data, writing it to file (or DBD or MySQL), release lock,
       then thread 2 locking that sess_id and so on..
       So in fact locked session_id, while session locked indirect,
       because no manipulation can be made before lock aquire and so
       manipulation with same sess_id data is quened across threads.

       And if i right, my module from previous letter will work with
       lock.

       Am i right?

-- 
Best regards,
 Norman                            mailto:NormanTindall at zdisk.net



More information about the Mod_python mailing list