Cached db url???

6 views
Skip to first unread message

Paul Kraus

unread,
Jun 2, 2016, 11:22:06 AM6/2/16
to TurboGears
In one of my apps i had to change the database location to a new server with new credentials. Everything is working great nothing tricky here. However i get a random error emailed to me, a rejection from the database, and in the email is the old url and credentials for the old postgresql server (no longer operational).

I have checked every script, every cron job, every ini file with in the app looking for what might be calling up this old URL. I even grepped the entire file system for the old db user name. Nothing.

Is it possible that the old url is cached somewhere? The trace back doesn't give me what i need to figure out where its getting the config from when it runs BUT it is from a part of the app where i am using tg.cache (mycache_cats)

cachedvalue_cats = mycache_cats.get_value(
            key=datetime.date.month,
            createfunc=self.get_item_cats,
            expiretime=3600
        )

So i'm thinking its cached somewhere BUT i am using memory for cache "beaker.cache.type = memory". I even bounced the server to make sure nothing was lingering in the memory (after restarting apache).

I also though maybe it was still writing something to cache on disk and searched everywhere and found nothing.

Even if it is cached shouldn't the results be cached and not the DBURL?


Alessandro Molina

unread,
Jun 4, 2016, 10:21:30 AM6/4/16
to TurboGears
On Thu, Jun 2, 2016 at 5:22 PM, Paul Kraus <pkr...@pelsupply.com> wrote:
I also though maybe it was still writing something to cache on disk and searched everywhere and found nothing.

It might be, search for where cache_dir in your .ini file points to. If it exists, you might want to clear that directory, it's where beaker saves caches to disk.
 
Even if it is cached shouldn't the results be cached and not the DBURL?

I never checked this, but as you are caching objects bound to a session, when the object it's pickled the session will probably be too with connection details.

One easy way to check this is by changing the cache key, jut use cats_%s % datetime.date.month instead of just datetime.date.month as the cache and will confirm if it's the cache or not :D

Paul Kraus

unread,
Jun 6, 2016, 11:47:59 AM6/6/16
to TurboGears
There was a folder on disk with session info in it but it hadn't been changed is early 2015. I deleted it anyways just because. Problem persisted and then i renamed the key like you suggested. Thanks as always!!
Reply all
Reply to author
Forward
0 new messages