ovea-deprecated / jetty-session-redis Goto Github PK
View Code? Open in Web Editor NEWJetty session clustering with Redis
Home Page: http://www.ovea.com/
Jetty session clustering with Redis
Home Page: http://www.ovea.com/
1 - The parent dependency need to be install
https://github.com/Ovea/ovea-pom
2 - Minor typo
jetty-session-redis => cd jetty-session-redis
*3 -The version of the parent pom should be 3 *
com.ovea
ovea
3-SNAPSHOT
pom
4 - The JBoss repository could be bundle in the pom.xml in order to find the deprecated package "trove:trove-2.1.1"
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
Hi,mathieucarbou
I ncountered a problem.I used jetty-session-redis to manage sessions in my application.And set maxmemory 1073741824.After some days,my application throws a JedisDataException.The I check the info about redis.It like that ..
redis_version:2.6.13
redis_git_sha1:00000000
redis_git_dirty:0
redis_mode:standalone
os:Linux 2.6.32-220.el6.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.4.6
process_id:4240
run_id:c083929bc6d87dd8040e31ebd54d3529445f9700
tcp_port:6370
uptime_in_seconds:5048530
uptime_in_days:58
hz:10
lru_clock:1325714
connected_clients:13
client_longest_output_list:0
client_biggest_input_buf:5
blocked_clients:0
used_memory:1073763352
used_memory_human:1.00G
used_memory_rss:1210474496
used_memory_peak:1077932944
used_memory_peak_human:1.00G
used_memory_lua:31744
mem_fragmentation_ratio:1.13
mem_allocator:jemalloc-3.2.0
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1418344888
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:7
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
total_connections_received:133186
total_commands_processed:5505726311
instantaneous_ops_per_sec:65
rejected_connections:0
expired_keys:1945695
evicted_keys:158476
keyspace_hits:65750982
keyspace_misses:31173
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:29585
role:master
connected_slaves:0
used_cpu_sys:7515.07
used_cpu_user:21328.05
used_cpu_sys_children:8893.95
used_cpu_user_children:92891.41
db0:keys=1,expires=0
The only one key is 'jetty-sessions'.It is so big that throws exception:redis.clients.jedis.exceptions.JedisDataException: redis.clients.jedis.exceptions.JedisDataException: OOM command not allowed when used memory > 'maxmemory'.
at redis.clients.jedis.Protocol.processError(Protocol.java:54)
at redis.clients.jedis.Protocol.process(Protocol.java:61)
at redis.clients.jedis.Protocol.read(Protocol.java:122)
at redis.clients.jedis.Connection.getIntegerReply(Connection.java:178)
at redis.clients.jedis.Jedis.sadd(Jedis.java:1161)
at com.ovea.jetty.session.redis.RedisSessionIdManager$3.execute(RedisSessionIdManager.java:85)
at com.ovea.jetty.session.redis.PooledJedisExecutor.execute(PooledJedisExecutor.java:36)
at com.ovea.jetty.session.redis.RedisSessionIdManager$1.execute(RedisSessionIdManager.java:65)
at com.ovea.jetty.session.redis.RedisSessionIdManager.storeClusterId(RedisSessionIdManager.java:82)
at com.ovea.jetty.session.SessionIdManagerSkeleton.addSession(SessionIdManagerSkeleton.java:136)
at org.eclipse.jetty.server.session.AbstractSessionManager.addSession(AbstractSessionManager.java:677)
at org.eclipse.jetty.server.session.AbstractSessionManager.newHttpSession(AbstractSessionManager.java:549)
at org.eclipse.jetty.server.Request.getSession(Request.java:1176)
at org.eclipse.jetty.server.Request.getSession(Request.java:1153)
................
Help please.
Hello,
I am trying to integrate your library into my current system:
By restarting the server the RedisSessionManager.loadFromStore method always returns null, because redisData.get(0) == null.
I debugged through my app and I found out that the the initial redisMap is never stored to redis:
{accessed=1361208311937, attributes={}, context=, cookieSet=0, created=1361208311937, expiryTime=1361210111, id=1q8ks6b5lyze111qrn18ah95x9, lastAccessed=1361208311937, lastNode=null, lastSaved=1361208313748, maxIdle=1800, virtualHost=0.0.0.0}
The following redis command '"HMGET" "jetty-session-1q8ks6b5lyze111qrn18ah95x9" "id" "created" "accessed" "lastNode" "expiryTime" "lastSaved" "lastAccessed" "maxIdle" "cookieSet" "attributes"' returns:
Do I miss something?
Thanks for your help
Hannes
If I'm a big application,
you have created a Redis cluster.
How to configure the configuration via redis to manage Session.
because Redis clusters can only operate redis. through JedisCluster
There is an issue with a cookies storing JSESSIONID and Google Chrome. Cookies are not accepted by Chrome when RedisSessionManager is configured with parameteres:
sessionDomain - localhost
sessionPath -/
maxCookieAge - 86400
refreshCookieAge - 300
Probably maxCookieAge is wrong but I tried with several values (f.e. -1, max) without success.
Hi Mathieu Carbou,
I wonder what is the timeframe for upgrading jetty-session-redis to be compatible with Jetty 9.1.5?
We currently use Jetty 9.1.5.v20140505 and jetty-session-redis-2.3.ga. We are not able to shutdown jetty properly because an abstract method, shutdownSessions, defined in AbstractSessionManager will have to be implemented.
It is really our problem. We shouldn't have used Jetty 9.1.5 as you have documented clearly in the software Compatibility section.
We are thinking to modify RedisSessionManager to add the missing implementation and contribute back to the source. What do you think please?
Best regards,
Jianping Roth
xMatters
wiki show"JEDIS website (tested on version 1.5.2),Jetty website (tested on version 8.0.0.M2)"
But an exception occur on my computer , the exception stack context:
[WARNING] FAILED ContextHandlerCollection@5f4d9eed: java.lang.NoClassDefFoundError: org/eclipse/jetty/server/session/AbstractSession
[WARNING] FAILED HandlerCollection@60fd0a7c: java.lang.NoClassDefFoundError: org/eclipse/jetty/server/session/AbstractSession
[WARNING] Error starting handlers
java.lang.NoClassDefFoundError: org/eclipse/jetty/server/session/AbstractSession
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructors(Class.java:1517)
at org.eclipse.jetty.xml.XmlConfiguration.newObj(XmlConfiguration.java:639)
at org.eclipse.jetty.xml.XmlConfiguration.itemValue(XmlConfiguration.java:949)
at org.eclipse.jetty.xml.XmlConfiguration.value(XmlConfiguration.java:874)
at org.eclipse.jetty.xml.XmlConfiguration.newObj(XmlConfiguration.java:633)
at org.eclipse.jetty.xml.XmlConfiguration.itemValue(XmlConfiguration.java:949)
at org.eclipse.jetty.xml.XmlConfiguration.value(XmlConfiguration.java:874)
at org.eclipse.jetty.xml.XmlConfiguration.set(XmlConfiguration.java:301)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:263)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:205)
at org.eclipse.jetty.plus.webapp.EnvConfiguration.configure(EnvConfiguration.java:98)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:473)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1174)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:598)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:496)
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:175)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:164)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
at org.eclipse.jetty.server.Server.doStart(Server.java:244)
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:67)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:447)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:387)
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:555)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.session.AbstractSession
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 52 more
[INFO] Started [email protected]:8080
[INFO] Started Jetty Server
I have a strange issue with sessions and JdkSerializer. Everything seems to work well, but every time when I restart my application I have an exception :
java.io.StreamCorruptedException: invalid type code: 00
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1355)
at java.io.ObjectInputStream.skipCustomData(ObjectInputStream.java:1911)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1873)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at java.util.HashMap.readObject(HashMap.java:1030)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at com.ovea.jetty.session.serializer.JdkSerializer.read(JdkSerializer.java:36)
at com.ovea.jetty.session.serializer.BinarySerializer.deserialize(BinarySerializer.java:65)
at com.ovea.jetty.session.redis.RedisSessionManager.loadFromStore(RedisSessionManager.java:167)
at com.ovea.jetty.session.redis.RedisSessionManager.loadSession(RedisSessionManager.java:104)
at com.ovea.jetty.session.redis.RedisSessionManager.loadSession(RedisSessionManager.java:38)
at com.ovea.jetty.session.SessionManagerSkeleton.getSession(SessionManagerSkeleton.java:119)
at com.ovea.jetty.session.SessionManagerSkeleton.getSession(SessionManagerSkeleton.java:39)
at org.eclipse.jetty.server.session.AbstractSessionManager.getHttpSession(AbstractSessionManager.java:272)
at org.eclipse.jetty.server.session.SessionHandler.checkRequestedSessionId(SessionHandler.java:277)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:158)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:351)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Thread.java:662)
Have no idea how to fix it. Every time I've to run flushall on Redis.
How would I use and configure this with the Jetty Maven Plugin?
http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html
RedisSessionIdManager.scavenge(...) uses a Long value (0L) to compare with a Boolean returned by Jedis.exists(key) and therefore the sessions are not able to be removed from SessionIdManagerSkeleton.sessions
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.