Problem Pickling Session

87 views
Skip to first unread message

Mark Erbaugh

unread,
Mar 6, 2018, 6:40:28 PM3/6/18
to web2py-users
I installed Web2py and Apache on a Raspberry Pi using the Ubuntu installation script. That script generated a self-signed SSL certificate.

If I access the app using HTTP on port 80 and HTTPS on port 443, all is fine.

This app is replacing a legacy app that needs to run HTTP on port 8080. I reconfigured Apache's ports.conf to listen on 8080 and default.conf to have a virtualhost on 8080.

The app works fine if I access it only via HTTP on port 8080 or HTTPS on port 443, but if you try to access it from the other port (443 if the first access after an Apache restart was on 8080 or 8080 if the first access was on 443), I get an error ticket. Clicking on the error ticket just leads to another ticket.

I copied the error file to another Web2py server and here's the traceback:

Traceback (most recent call last):
File "/home/www-data/web2py/gluon/main.py", line 434, in wsgibase
session.connect(request, response)
File "/home/www-data/web2py/gluon/globals.py", line 1000, in connect
session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
File "/home/www-data/web2py/gluon/storage.py", line 52, in <lambda>
__getnewargs__ = lambda self: getattr(dict,self).__getnewargs__(self)
TypeError: getattr(): attribute name must be string

I think Web2py is having problems pickling the Session object. I added a diagnostic printout and when the pickle is failing the Session object prints as Storage({}), which I assume is an empty object. However, working with the diagnostic printout, I also see cases where an empty object pickles just fine, just not ones generated when I switched ports.

Massimo Di Pierro

unread,
Mar 7, 2018, 1:07:15 AM3/7/18
to web2py-users
Hello Mark,

which web2py version?
usually this error happens when you have a session created with a different version of web2py. Try clear everything in your apps sessions folder. Does it solve the problem?

Mark Erbaugh

unread,
Mar 7, 2018, 5:11:29 PM3/7/18
to web...@googlegroups.com
Web2Py is 2.16.1-stable+timestamp.2017.11.14.05.54.25

I tried deleting all the files in the application (both my application and admin) sessions folders, but still have the same error.

Massimo Di Pierro

unread,
Mar 16, 2018, 12:20:32 AM3/16/18
to web2py-users
do you have session in cookie or db? Do you have a line in your code like session.connect(....)?

Tiago Alves

unread,
Feb 23, 2019, 10:48:21 PM2/23/19
to web2py-users
Hello!

I am facing the same issue. Has anyone come up with a solution to this problem?

Thanks

Leonel Câmara

unread,
Feb 24, 2019, 3:18:34 PM2/24/19
to web2py-users
I used to have this error when I used Apache, my solution was simply to stop using apache, just use nginx and uwsgi and the problem just goes away. Alternatively you can clear your cookies or use a private browser window to access the app via https. 
Reply all
Reply to author
Forward
0 new messages