Hi all. I've got several problems for moving the sessions to the memory. Now they're in the DB, adding this to the model: session.connect(request, response, db)
It works fine and the website is faster. Il giorno venerdì 19 luglio 2019 14:31:38 UTC+2, Gaël Princivalle ha scritto: > > Hi Zoltán. > > python-six module is installed. > > 0_memcache.py is like in the documentation: > 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 > > I've added this in the model db.py: > from gluon.contrib.memdb import MEMDB > session.connect(request, response, db=MEMDB(cache.memcache)) > > The last row generate this ticket: > Ticket ID > > > 2a00_23a8_400d_c001_3d4c_5b50_35a9_dfdf.2019-07-19.12-25-46.c3413f14-b228-4390-bc14-2f7092907e01 > Versione > web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 > Python Python 2.7.5: /usr/bin/python (prefix: /usr)Traceback > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > > Traceback (most recent call last): > File "/home/tasko/webapps/w2p_2_14_16/web2py/gluon/main.py", line 464, in > wsgibase > session._try_store_in_db(request, response) > File "/home/tasko/webapps/w2p_2_14_16/web2py/gluon/globals.py", line 1183, > in _try_store_in_db > record_id = table.insert(**dd) > File "/home/tasko/webapps/w2p_2_14_16/web2py/gluon/contrib/memdb.py", line > 264, in insert > raise RuntimeError("Too many ID conflicts") > RuntimeError: Too many ID conflicts > > Error snapshot [image: help] > <https://prod2.tasko.it/admin/ticket/hydrover_oleodinamica/2a00_23a8_400d_c001_3d4c_5b50_35a9_dfdf.2019-07-19.12-25-46.c3413f14-b228-4390-bc14-2f7092907e01#> > > <type 'exceptions.RuntimeError'>(Too many ID conflicts) > > inspect attributes > Frames > > - > > *File /home/tasko/webapps/w2p_2_14_16/web2py/gluon/main.py in wsgibase > at line 464* code arguments variables > - > > *File /home/tasko/webapps/w2p_2_14_16/web2py/gluon/globals.py in > _try_store_in_db at line 1183* code arguments variables > - > > *File /home/tasko/webapps/w2p_2_14_16/web2py/gluon/contrib/memdb.py in > insert at line 264* code arguments variables > Function argument list > > (self=<DALStorage {'client_ip': <pydal.objects.Field o... > <pydal.objects.Field object at 0x7f6dd7c6e890>}>, **fields={'client_ip': > '2a00.23a8.400d.c001.3d4c.5b50.35a9.dfdf', 'locked': False, > 'modified_datetime': datetime.datetime(2019, 7, 19, 12, 25, 46, 854949), > 'session_data': > > '\x80\x02cgluon.globals\nSession\nq\x01}q\x02(U\x19_formkey[no_tab...\x13(h\x0bU\r75.0.3770.142q\x14h\rU\x06Chromeq\x15u\x85Rq\x16u\x85Rq\x17u\x85Rq\x18.', > > 'unique_key': '25d6cb33-4709-4b14-987d-06aef044ac67'}) > Code listing > > 259. > 260. > 261. > 262. > 263. > 264. > > 265. > 266. > 267. > 268. > > for i in range(3): > id = self._create_id() > if self.get(id) is None and self.update(id, **fields): > return long(id) > else: > raise RuntimeError("Too many ID conflicts") > > > def get(self, id): > val = self._tableobj.get(self._id_to_key(id)) > if val: > > > Do you know why? > > Il giorno giovedì 18 luglio 2019 12:58:50 UTC+2, Gaël Princivalle ha > scritto: >> >> Hi Zoltán, for the moment I've modified my crontab for deleting the >> sessions every hour. >> >> I'll try to install python-six module and store the sessions in the >> memory in the next days. >> >> Il giorno giovedì 18 luglio 2019 11:03:37 UTC+2, Fekete Zoltán ha scritto: >>> >>> Hi Gael! >>> >>> Could you solve the problem? Pls. give a short feedback. >>> >>> Regards, >>> Zoltán >>> >>> 2019. július 13., szombat 9:03:17 UTC+2 időpontban Massimo Di Pierro a >>> következőt írta: >>>> >>>> what os is this? >>>> >>>> On Friday, 12 July 2019 01:00:03 UTC-7, Gaël Princivalle wrote: >>>>> >>>>> Hi all. >>>>> >>>>> In my sessions folder all sessions are stored in separated >>>>> sub-folders, 068,069... >>>>> The file system don't accept more than 512 sub-folders in a folder. >>>>> When I reach 512 sub-folders the website is down. >>>>> Now for avoiding this problem I delete all the sessions with a crontab >>>>> job every 12 hours, but it's not enough. >>>>> >>>>> Obviously I can imagine that deleting all the sessions means also >>>>> disconnecting all the users, that's not a good thing. >>>>> >>>>> Can I store the sessions in the DB instead of the file system? >>>>> >>>>> And what about that? I don't understand where I must add it, and it >>>>> seems that the sessions storage for my website works already like that, >>>>> >>>>> http://web2py.com/books/default/chapter/29/04/the-core#Separate-sessions >>>>> >>>>> Thanks. >>>>> >>>>> >>>>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/2f0c247e-ba8a-4c6f-89b1-0f72b05c7e88%40googlegroups.com.