ProgrammingError: Cannot operate on a closed database

718 views
Skip to first unread message

Martin Weissenboeck

unread,
Sep 17, 2012, 1:20:57 AM9/17/12
to web...@googlegroups.com
I have read some threads about this error message -  I got it too:

Version

web2py™ (2, 0, 9, datetime.datetime(2012, 9, 13, 23, 51, 30), 'stable')

Traceback


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.

Traceback (most recent call last):
File "/users/www-data/web2py/gluon/main.py", line 547, in wsgibase
session._try_store_on_disk(request, response)
File "/users/www-data/web2py/gluon/globals.py", line 686, in _try_store_on_disk
cPickle.dump(dict(self), response.session_file)
File "/usr/lib/python2.7/copy_reg.py", line 74, in _reduce_ex
getstate = self.__getstate__
File "/users/www-data/web2py/gluon/dal.py", line 7344, in __getattr__
self.__allocate()
File "/users/www-data/web2py/gluon/dal.py", line 7337, in __allocate
self._record = self._table[int(self)]
File "/users/www-data/web2py/gluon/dal.py", line 7624, in __getitem__
return self._db(self._id == key).select(limitby=(0,1)).first()
File "/users/www-data/web2py/gluon/dal.py", line 8766, in select
return adapter.select(self.query,fields,attributes)
File "/users/www-data/web2py/gluon/dal.py", line 2094, in select
return super(SQLiteAdapter, self).select(query, fields, attributes)
File "/users/www-data/web2py/gluon/dal.py", line 1594, in select
return self._select_aux(sql,fields,attributes)
File "/users/www-data/web2py/gluon/dal.py", line 1559, in _select_aux
self.execute(sql)
File "/users/www-data/web2py/gluon/dal.py", line 1671, in execute
return self.log_execute(*a, **b)
File "/users/www-data/web2py/gluon/dal.py", line 1665, in log_execute
ret = self.cursor.execute(*a, **b)
ProgrammingError: Cannot operate on a closed database.

Any hints?
Regards, Martin

Paolo

unread,
Sep 17, 2012, 3:23:27 AM9/17/12
to web...@googlegroups.com, mar...@weissenboeck.at
Dear all,
occasionally, I am getting this error too (with and without lazy_table)
Which OS are you using ?
Could you post your db model?

Paolo

Martin Weissenboeck

unread,
Sep 17, 2012, 3:59:10 AM9/17/12
to web...@googlegroups.com
From the /var/log/apache2/error.log:

[Mon Sep 17 09:39:09 2012] [error] ERROR:web2py:Traceback (most recent call last):
[Mon Sep 17 09:39:09 2012] [error]   File "/users/www-data/web2py/gluon/main.py", line 547, in wsgibase
[Mon Sep 17 09:39:09 2012] [error]     session._try_store_on_disk(request, response)
[Mon Sep 17 09:39:09 2012] [error]   File "/users/www-data/web2py/gluon/globals.py", line 686, in _try_store_on_disk
[Mon Sep 17 09:39:09 2012] [error]     cPickle.dump(dict(self), response.session_file)
[Mon Sep 17 09:39:09 2012] [error]   File "/usr/lib/python2.7/copy_reg.py", line 70, in _reduce_ex
[Mon Sep 17 09:39:09 2012] [error]     raise TypeError, "can't pickle %s objects" % base.__name__
[Mon Sep 17 09:39:09 2012] [error] TypeError: can't pickle lock objects
[Mon Sep 17 09:39:09 2012] [error]


2012/9/17 Paolo <paolo....@gmail.com>
--
 

Massimo Di Pierro

unread,
Sep 17, 2012, 8:05:51 AM9/17/12
to web...@googlegroups.com, mar...@weissenboeck.at
Looks like the problem is that you try pus something in session that is not pickleable.

Martin Weissenboeck

unread,
Sep 17, 2012, 1:54:08 PM9/17/12
to web...@googlegroups.com
Yes, I have stored a lot of information in session, but only strings and dicts. The application works fine on my development pc (a windows 7 pc). The problem arises after I have put the application on the target machine (ubuntu with apache2).

2012/9/17 Massimo Di Pierro <massimo....@gmail.com>

Massimo Di Pierro

unread,
Sep 17, 2012, 2:59:37 PM9/17/12
to web...@googlegroups.com, mar...@weissenboeck.at
You error seems to indicate there is a lock object in session. Can you try check by printing the session.keys() before saving the session?

Martin Weissenboeck

unread,
Sep 19, 2012, 1:50:37 PM9/19/12
to web...@googlegroups.com
Solved.
The permission of a lot files have been wrong:
I develop an application on a windows system and the target system is a linux machine. Some permissions got wrong values after copying the application files.


--
 
 
 


Hassan Alnatour

unread,
Oct 22, 2012, 3:12:21 AM10/22/12
to web...@googlegroups.com, mar...@weissenboeck.at

Dear mweissen 

i am having the same problem but on a windows server !?  can you help me  ? from where should i start ??

regards,


Cliff Kachinske

unread,
Oct 22, 2012, 3:30:47 PM10/22/12
to web...@googlegroups.com, mar...@weissenboeck.at
You can install Linux alongside Windows using the dual boot option.  That way you won't have to manually ensure file perms are correct.

I ran this way for a time, but then I dropped Windows completely.

hasan alnator

unread,
Oct 22, 2012, 4:01:22 PM10/22/12
to web...@googlegroups.com
Dear Cliff,

Can you give me more guides on how to apply this ?

Best Regards,



--
 
 
 

Martin Weissenboeck

unread,
Oct 22, 2012, 4:31:08 PM10/22/12
to web...@googlegroups.com
I have tried several things, but I am not sure what solved the problem:
  • DAL with pool_size=10
  • All Linux-files got the same rights (755)
Sorry, I think this is not much help.

2012/10/22 hasan alnator <haln...@gardeniatelco.com>

hasan alnator

unread,
Oct 23, 2012, 2:38:51 AM10/23/12
to web...@googlegroups.com
Dear Martin, 

i am using web2py 1.9.9  on a windows server , everything is fine but i keep getting this error everything i update web2py to the new one , i hope you can help me to solve this problem ..

Regards,

--
 
 
 

Reply all
Reply to author
Forward
0 new messages