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

jedis: IllegalStateException: Object has already been returned to this pool or is invalid #732

Closed
pierredavidbelanger opened this issue Apr 20, 2017 · 0 comments
Labels
Milestone

Comments

@pierredavidbelanger
Copy link
Contributor

Using jooby 1.1.0, with this simple code (inspired by this doc):

use(new Redis());

get("/redis", () -> {
    try (Jedis jedis = require(Jedis.class)) {
        jedis.get("dummy");
        return "HelloWorld!";
    }
});

and this config:

db = "redis://localhost:6379"

When I access /redis the first time it works, then every other request fails with:

Stacktrace:
org.jooby.Err: Server Error(500)
	at org.jooby.internal.HttpHandlerImpl.handleErr(HttpHandlerImpl.java:405)
	at org.jooby.internal.HttpHandlerImpl.cleanup(HttpHandlerImpl.java:378)
	at org.jooby.internal.HttpHandlerImpl.handle(HttpHandlerImpl.java:320)
	at org.jooby.internal.undertow.UndertowHandler.handleRequest(UndertowHandler.java:67)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:211)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:809)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: redis.clients.jedis.exceptions.JedisException: Could not return the resource to the pool
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:129)
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:12)
	at redis.clients.jedis.Jedis.close(Jedis.java:3357)
	at ca.routeo.App.lambda$new$0(App.java:90)
	at org.jooby.Route$ZeroArgHandler.handle(Route.java:1797)
	at org.jooby.internal.RouteImpl.handle(RouteImpl.java:97)
	at org.jooby.internal.RouteChain.next(RouteChain.java:77)
	at org.jooby.Route$Chain.next(Route.java:2109)
	at org.jooby.internal.HttpHandlerImpl.handle(HttpHandlerImpl.java:312)
	... 6 common frames omitted
Caused by: redis.clients.jedis.exceptions.JedisException: Could not return the resource to the pool
	at redis.clients.util.Pool.returnResourceObject(Pool.java:69)
	at redis.clients.jedis.JedisPool.returnResource(JedisPool.java:126)
	... 14 common frames omitted
Caused by: java.lang.IllegalStateException: Object has already been returned to this pool or is invalid
	at org.apache.commons.pool2.impl.GenericObjectPool.returnObject(GenericObjectPool.java:551)
	at redis.clients.util.Pool.returnResourceObject(Pool.java:67)
	... 15 common frames omitted
pierredavidbelanger added a commit to pierredavidbelanger/jooby that referenced this issue Apr 21, 2017
pierredavidbelanger added a commit to pierredavidbelanger/jooby that referenced this issue Apr 21, 2017
…dy been returned to this pool or is invalid)
@jknack jknack added the bug label Apr 21, 2017
@jknack jknack added this to the 1.1.1 milestone Apr 21, 2017
pierredavidbelanger added a commit to pierredavidbelanger/jooby that referenced this issue Apr 22, 2017
@jknack jknack closed this as completed in 46ea40e Apr 22, 2017
jknack added a commit that referenced this issue Apr 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants