Why do the devs hate GAE? (two huge bugs and their stupid solutions)

108 views
Skip to first unread message

webm...@trytha.com

unread,
Apr 30, 2017, 7:47:19 PM4/30/17
to web2py-users
Figured this should have a new topic because it's been a year without two massive bugs being addressed.  The last version of DAL that fully works with Cloud SQL I'm aware of is 2.12.2...  Yes, it's been broken THAT long.

To get Cloud SQL working, you have to replace pydal in gluon with an older version (16.03 works but was immediately broken by a commit on the same day).

I went through github and this seems to be the last commit that broke Cloud SQL (the version of pydal from the previous commit seems to work fine):  https://github.com/web2py/pydal/commit/4fee2923db00763c4a4666c5ad0e5c1104e8f24a

Also, my post at the following link is the only way to get lost password requests working on GAE right now:  https://groups.google.com/forum/#!topic/web2py/YndwuzoEypw

Could one of the mods mark my final answer on that link as "best answer" since I can't do it on my own post?

Massimo Di Pierro

unread,
May 1, 2017, 10:21:12 AM5/1/17
to web2py-users
Can you provide a quick summary of the problem you are having with Cloud SQL? 
I will make it a priority to fix it.

webm...@trytha.com

unread,
May 1, 2017, 11:53:01 AM5/1/17
to web2py-users
Same problems as I detailed on this thread:


Basically, it seems like it was fixed and then immediately broken again.  The commit I mention above is the one where it was broken again.

webm...@trytha.com

unread,
May 1, 2017, 11:56:47 AM5/1/17
to web2py-users
Ah, I think the problem might actually be slightly different, but the solution is the same.  If I recall correctly, the error I was getting said something about super() not having a method called something like _find_work_folder().  I can give you the exact error when I get home later today.

webm...@trytha.com

unread,
May 1, 2017, 7:30:59 PM5/1/17
to web2py-users
Here is the error from the current version of pydal when trying to connect to Cloud SQL (my memory is better than I thought):

  File "/Dev/Trytha/web2py/gluon/packages/dal/pydal/adapters/google.py", line 44, in _find_work_folder


    super(GoogleSQL)._find_work_folder()


AttributeError: 'super' object has no attribute '_find_work_folder'

Dave S

unread,
May 1, 2017, 8:29:55 PM5/1/17
to web2py-users


On Monday, May 1, 2017 at 4:30:59 PM UTC-7, webm...@trytha.com wrote:
Here is the error from the current version of pydal when trying to connect to Cloud SQL (my memory is better than I thought):

  File "/Dev/Trytha/web2py/gluon/packages/dal/pydal/adapters/google.py", line 44, in _find_work_folder


    super(GoogleSQL)._find_work_folder()


AttributeError: 'super' object has no attribute '_find_work_folder'






If I read the other thread correctly, Massimo couldn't reproduce your error (and AIUI, he uses GAE in his own projects).  Do you have a sample app that shows the error?

/dps


 

webm...@trytha.com

unread,
May 1, 2017, 8:56:14 PM5/1/17
to web2py-users
The steps are kinda simple:

1. Install web2py:
git clone --recursive https://github.com/web2py/web2py.git


2. Move gaehandler.py and app.yaml into the web2py directory.

3. In the Welcome app, change the GAE connection string in db.py to:  
db = DAL('google:sql://[$project]:[$instance]/[$database]')

4. Run GAE from command prompt:

python /Dev/Trytha/google-cloud-sdk/bin/dev_appserver.py --host=0.0.0.0 --mysql_host=localhost --mysql_port=3306 --mysql_user=root --mysql_password='[$password]' /Dev/Trytha/web2py


5. At this point, the Welcome app gives the error I just posted where super() doesn't have _find_work_folder() but if you change just pydal to a working version (2.12.2, for instance), it will work fine.  Don't even need to relaunch anything, you can just hot swap between broken and working versions of pydal (how I found the specific commit that broke everything).

webm...@trytha.com

unread,
May 1, 2017, 9:09:42 PM5/1/17
to web2py-users
I could zip that up into an app if you like, but I can literally change any portion of that connection string and have it work in the old version of pydal and not work in the new version (in a completely fresh web2py install which I performed while I wrote the steps to replicate).  This is also a shiny, fresh OSX install, so I can't see this being some sort of interaction specific to my computer.

webm...@trytha.com

unread,
May 1, 2017, 9:41:22 PM5/1/17
to web2py-users
Ah, I think the reason he couldn't replicate it last time was because it was a different error that he had already fixed.  The SQL was broken during 15.x, I believe, then working for a very short period (1 day) during 16.03, then broken again in a different way.

Dave S

unread,
May 1, 2017, 9:51:42 PM5/1/17
to web2py-users


On Monday, May 1, 2017 at 6:09:42 PM UTC-7, webm...@trytha.com wrote:
I could zip that up into an app if you like, but I can literally change any portion of that connection string and have it work in the old version of pydal and not work in the new version (in a completely fresh web2py install which I performed while I wrote the steps to replicate).  This is also a shiny, fresh OSX install, so I can't see this being some sort of interaction specific to my computer.


Ok, fair enough.

/dps


 

webm...@trytha.com

unread,
May 2, 2017, 1:14:20 AM5/2/17
to web2py-users
I guess if you can't replicate, the full error might be helpful:

ERROR    2017-05-02 02:36:08,394 restricted.py:171] Traceback (most recent call last):


  File "/Users/sin/Dev/Trytha/web2py/gluon/restricted.py", line 216, in restricted


    exec(ccode, environment)


  File "/Users/sin/Dev/Trytha/web2py/applications/welcome/models/db.py", line 40, in <module>


    db = DAL('google:sql://trytha-1104:test4/test4')


  File "/Users/sin/Dev/Trytha/web2py/gluon/packages/dal/pydal/base.py", line 170, in __call__


    obj = super(MetaDAL, cls).__call__(*args, **kwargs)


  File "/Users/sin/Dev/Trytha/web2py/gluon/packages/dal/pydal/base.py", line 475, in __init__


    "Failure to connect, tried %d times:\n%s" % (attempts, tb)


RuntimeError: Failure to connect, tried 5 times:


Traceback (most recent call last):


  File "/Users/sin/Dev/Trytha/web2py/gluon/packages/dal/pydal/base.py", line 455, in __init__


    self._adapter = adapter(**kwargs)


  File "/Users/sin/Dev/Trytha/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 40, in __call__


    obj = super(AdapterMeta, cls).__call__(*args, **kwargs)


  File "/Users/sin/Dev/Trytha/web2py/gluon/packages/dal/pydal/adapters/google.py", line 40, in __init__


    super(GoogleSQL, self).__init__(*args, **kwargs)


  File "/Users/sin/Dev/Trytha/web2py/gluon/packages/dal/pydal/adapters/base.py", line 367, in __init__


    super(SQLAdapter, self).__init__(*args, **kwargs)


  File "/Users/sin/Dev/Trytha/web2py/gluon/packages/dal/pydal/adapters/base.py", line 50, in __init__


    self._initialize_(do_connect)


  File "/Users/sin/Dev/Trytha/web2py/gluon/packages/dal/pydal/adapters/google.py", line 49, in _initialize_


    super(MySQL, self)._initialize_(do_connect)


  File "/Users/sin/Dev/Trytha/web2py/gluon/packages/dal/pydal/adapters/base.py", line 63, in _initialize_


    self._find_work_folder()


  File "/Users/sin/Dev/Trytha/web2py/gluon/packages/dal/pydal/adapters/google.py", line 44, in _find_work_folder


    super(GoogleSQL)._find_work_folder()


AttributeError: 'super' object has no attribute '_find_work_folder'


I'll see if I can get everything working in a different environment.

Karoly Kantor

unread,
May 2, 2017, 9:26:45 AM5/2/17
to web2py-users

Dear Massimo,

As you are looking into this particular issue, may I please suggest that you test it with a 2nd generation Google Cloud SQL instance? That would, with the same effort, automatically address the issue I have raised earlier. (Google declared 1st generation Cloud SQL instances "legacy", so this seems logical anyway.)

Thank you!

webm...@trytha.com

unread,
May 3, 2017, 12:26:04 AM5/3/17
to web2py-users
Well, I spun up a test server on GAE and it works fine with my app.  So now my best guess is that the problem is specific to OSX.  Anyone else have a mac to test on?  I'm afraid I only have the one.
Reply all
Reply to author
Forward
0 new messages