Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heroku timesout when connecting to RedisToGo with Aleph #53

Closed
dmix opened this issue Feb 16, 2012 · 9 comments
Closed

Heroku timesout when connecting to RedisToGo with Aleph #53

dmix opened this issue Feb 16, 2012 · 9 comments

Comments

@dmix
Copy link

dmix commented Feb 16, 2012

I'm trying to deploy a clojure Noir app to heroku, but the deployment fails because the app timesout and never properly starts

When I remove the Aleph redis code, it deploys fine. Also, oddly, when I connect to the heroku server and use a REPL, paste in the same aleph connection code, I can access redis no problem.

(def r (redis-client {:host redis-url :password redis-pass :port redis-port}))

So since the problem is at bootup, is there a way to load the redis connection differently or at a later time? For example, on the first request: connect to redis if it hasn't yet?

The code for my app is here: https://github.com/dmix/documeds

@ztellman
Copy link
Collaborator

(def r (delay (redis-client ...)))

(@r [:get :foo])

should only connect when you make your first request. I think there's definitely value in having a :lazy-connect? option, though. Expect to see it in a future release.

@dmix
Copy link
Author

dmix commented Feb 16, 2012

Thanks Zach,

Tested out delaying the connection: dmix/documeds@2aca28b

But its still timing out on deploy. I've contacted Heroku, but its been almost 20hrs with no reply. So I imagine they dont have an easy answer either.

This may be more of a heroku problem than a Aleph, so I'll likely close this issue shortly unless I can think of some other ideas.

@ztellman
Copy link
Collaborator

How is the timeout manifesting itself? I don't see a timeout on the Redis calls, this is just when it's connecting?

@mpenet
Copy link
Contributor

mpenet commented Feb 16, 2012

Could it be an issue with the options you pass to the client ?

From the names it seems you are using an URL instead of a hostname as a value for :host
https://github.com/dmix/documeds/blob/master/src/documeds/settings.clj#L4
https://github.com/dmix/documeds/blob/master/src/documeds/models/medication.clj#L19

@dmix
Copy link
Author

dmix commented Feb 16, 2012

Yeah I'd like to provide more details on where its timing out, but heroku/clojure isnt outputting anything. Here are the heroku logs https://gist.github.com/1842439

When I connect locally or to the remote repl ("heroku run lein run repl") and paste in the same aleph code, it works. So I imagine the credentials are fine. The url variable is indeed the RedisToGo host and not the full URL.

@ztellman
Copy link
Collaborator

Okay, I see from your issue on the Heroku mailing list that it's never starting up the server. If you just

(def r nil)

does that boot up okay? If you've delayed the creation of the redis client, there's no way it should be interfering with the server starting up.

@dmix
Copy link
Author

dmix commented Feb 16, 2012

Yep, if I define (def r ()) it deploys fine.

@ztellman
Copy link
Collaborator

Can you log when the redis-client is realized? Something like

(def r 
  (delay 
    (println "REALIZING...")
    (redis-client {:host redis-url :password redis-pass :port redis-port})))

You might even try (.printStackTrace (Exception.)) within the delay scope to tell you what's triggering it. The only way the empty value and delay block can differ in the behavior is if something's realizing the client before the server binds to the port.

@dmix
Copy link
Author

dmix commented Feb 16, 2012

Went for a coffee and came back,now its running fine in production. Tried redeploying and it worked again.

It's possible that a) delaying the process fixed the issue and it didn't deploy properly earlier or b) a heroku staffer fixed the issue and hasnt notified me yet.

Either way its fixed and I appreciate the help.

@dmix dmix closed this as completed Feb 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants