Thanks Massimo. 

So, is session.connect(request, response, db=db) my only option for mysql 
at the moment?  i tried to get memcache working, but getting stuck with 
syntax... is there a valid sample somewhere?

In one of the posts I found this code, but getting an error bellow... 

from gluon.contrib.memcache import MemcacheClient
memcache_servers = ['127.0.0.1:11211']
cache.memcache = MemcacheClient(request, memcache_servers)
cache.ram = cache.disk = cache.memcache

from gluon.contrib.memdb import MEMDB
session.connect(request,response,db=MEMDB(cache.memcache))

session.connect(request, response, db=MEMDB(cache.memcache))


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.

Traceback (most recent call last):
  File "/Users/adnan/web2py24/gluon/main.py", line 557, in wsgibase
    session._try_store_in_db(request, response)
  File "/Users/adnan/web2py24/gluon/globals.py", line 739, in _try_store_in_db
    record_id = table.insert(**dd)
  File "/Users/adnan/web2py24/gluon/contrib/memdb.py", line 256, in insert
    id = self._create_id()
  File "/Users/adnan/web2py24/gluon/contrib/memdb.py", line 296, in _create_id
    raise Exception('cannot set memcache')
Exception: cannot set memcache


Frames              

   - 
   
   
               *File /Users/adnan/web2py24/gluon/main.py in wsgibase at 
   line 557*
               code
               arguments
               variables                                  
   
               *File /Users/adnan/web2py24/gluon/globals.py in_try_store_in_db 
at line 
   739*
               code
               arguments
               variables               
       
   
               *File /Users/adnan/web2py24/gluon/contrib/memdb.py in insert 
   at line 256*
               code
               arguments
               variables                    
   
   
               *File /Users/adnan/web2py24/gluon/contrib/memdb.py in_create_id 
at line 
   296*
               code
               arguments
               variables            
   Function argument list
               
   
   (self=<DALStorage {'client_ip': <gluon.contrib.memdb.F...luon.contrib.
   memdb.Field object at 0x113dc9a90>}>)           
   Code listing
               
               
   
   291.
   292.
   293.
   294.
   295.
   296.
   
   297.
   298.
   299.
   300.
   
           id = self._tableobj.incr(shard_id)
           if not id:
               if self._tableobj.set(shard_id, '0'):
                   id = 0
               else:
                   raise Exception('cannot set memcache')
   
           return long(str(shard) + str(id))
   
       def __str__(self):
           return self._tablename
   
   - 
   
Enter code here...







On Saturday, December 22, 2012 12:38:06 PM UTC-5, Massimo Di Pierro wrote:
>
> In think the problem is exactly the size of the cookie.
>
> On Saturday, 22 December 2012 10:15:20 UTC-6, Adi wrote:
>>
>> Sorry Massimo,
>> Seems I was looking into wrong error_log... This one is related to 
>> web2py... JUst run it again: 
>>
>> [Sat Dec 22 11:10:53 2012] [error] [client 24.150.57.81] (13)Permission 
>> denied: access to /mobipp_us/static/plugin_wiki/rating/jquery.rating.js 
>> denied, referer: http://w.replacedserver.com/mobipp_us/category/11
>> [Sat Dec 22 11:10:57 2012] [error] [client 24.150.57.81] malformed header 
>> from script. Bad header=QRZl7DmMFohP98mTnbyI4cEEvQcxWS: wsgihandler.py, 
>> referer: http://w.replacedserver.com/mobipp_us/category/11
>>
>>
>>
>> On Saturday, December 22, 2012 10:32:34 AM UTC-5, Adi wrote:
>>>
>>> Size could definitely be my problem... 
>>>
>>> Bellow is the bottom part of the Apache error log: 
>>> [Sat Dec 22 04:22:50 2012] [error] k,len 0 3
>>> [Sat Dec 22 04:22:50 2012] [error] k,len 1 3
>>> [Sat Dec 22 04:22:50 2012] [error] k,len 2 3
>>> [Sat Dec 22 04:22:54 2012] [error] k,len 0 3
>>> [Sat Dec 22 04:22:54 2012] [error] k,len 1 3
>>> [Sat Dec 22 04:22:54 2012] [error] k,len 2 3
>>> [Sat Dec 22 07:39:04 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
>>> ['2012-12-22T12:39:04Z'], 'TOKEN': ['EC-25J033232E8733719'], 'VERSION': 
>>> ['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['2fcce583dd4e2']}
>>> [Sat Dec 22 08:18:29 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
>>> ['2012-12-22T13:18:29Z'], 'TOKEN': ['EC-3RG928080L406004A'], 'VERSION': 
>>> ['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['bea4a71f87268']}
>>> [Sat Dec 22 08:25:17 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
>>> ['2012-12-22T13:25:17Z'], 'TOKEN': ['EC-7GY27898JG123493D'], 'VERSION': 
>>> ['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['3941637927a28']}
>>> [Sat Dec 22 08:26:09 2012] [error] k,len 0 1
>>> [Sat Dec 22 08:26:23 2012] [error] k,len 0 1
>>>
>>> I would like to steer away from db sessions, since we had a large 
>>> problem when doing PCI compliance test with nCircle... They could literally 
>>> bring our websites down due to opening million parallel connections, which 
>>> should be fine... The error was on our side :) Memcache resolved that 
>>> problem, but that was with php. Now, I would like to use the similar 
>>> approach with web2py, and then we can test a pci scan :) 
>>>
>>>
>>> On Saturday, December 22, 2012 10:02:28 AM UTC-5, Massimo Di Pierro 
>>> wrote:
>>>>
>>>> Can you please look for the error in the apache logs?
>>>>
>>>> There is a limitation in the cookie size wich may break for large 
>>>> sessions. 
>>>>
>>>> On Saturday, 22 December 2012 08:49:04 UTC-6, Adi wrote:
>>>>>
>>>>>
>>>>>
>>>>> I tried using session.connect(cookie_key='key', compression_level=9) 
>>>>> instead of session.connect(request, response, db=db), and got theerror as 
>>>>> bellow, plus some inconsistent unexpected behavior. When I rolled 
>>>>> back to db sessions all works fine as expected. It's an e-commerce 
>>>>> app, using sessions bit heavier. 
>>>>>
>>>>> Are there known limitations for using cookie sessions? Also, if I can 
>>>>> use memcache with mysql, how do I define a client? Tried mc = 
>>>>> memcache.Client(['127.0.0.1:11211'], debug=0), with no success...
>>>>>
>>>>> Thanks,
>>>>> Adnan
>>>>>
>>>>>
>>>>> web2py: Version 2.3.2 (2012-12-17 15:03:30) stable
>>>>>
>>>>> OK
>>>>>
>>>>>
>>>>> The server encountered an internal error or misconfiguration and was 
>>>>> unable to complete your request.
>>>>>
>>>>> Please contact the server administrator, root@localhost and inform 
>>>>> them of the time the error occurred, and anything you might have done 
>>>>> that 
>>>>> may have caused the error.
>>>>>
>>>>> More information about this error may be available in the server error 
>>>>> log.
>>>>> Apache/2.2.3 (Red Hat) Server at w2p.demo.com Port 80
>>>>>
>>>>>
>>>>>

-- 



Reply via email to