Code Monkey home page Code Monkey logo

embedded-redis's Introduction

embedded-redis

Build Status Windows

Build Status Linux

Redis embedded server for Java integration testing

Maven dependency

Maven Central:

<dependency>
  <groupId>com.github.kstyrc</groupId>
  <artifactId>embedded-redis</artifactId>
  <version>0.6</version>
</dependency>

Previous releases (before 0.6):

<repository>
  <id>clojars.org</id>
  <url>http://clojars.org/repo</url>
</repository>

...

<dependency>
  <groupId>redis.embedded</groupId>
  <artifactId>embedded-redis</artifactId>
  <version>0.5</version>
</dependency>

Usage

Running RedisServer is as simple as:

RedisServer redisServer = new RedisServer(6379);
redisServer.start();
// do some work
redisServer.stop();

You can also provide RedisServer with your own executable:

// 1) given explicit file (os-independence broken!)
RedisServer redisServer = new RedisServer("/path/to/your/redis", 6379);

// 2) given os-independent matrix
RedisExecProvider customProvider = RedisExecProvider.defaultProvider()
  .override(OS.UNIX, "/path/to/unix/redis")
  .override(OS.WINDOWS, Architecture.x86, "/path/to/windows/redis")
  .override(OS.Windows, Architecture.x86_64, "/path/to/windows/redis")
  .override(OS.MAC_OS_X, Architecture.x86, "/path/to/macosx/redis")
  .override(OS.MAC_OS_X, Architecture.x86_64, "/path/to/macosx/redis")
  
RedisServer redisServer = new RedisServer(customProvider, 6379);

You can also use fluent API to create RedisServer:

RedisServer redisServer = RedisServer.builder()
  .redisExecProvider(customRedisProvider)
  .port(6379)
  .slaveOf("locahost", 6378)
  .configFile("/path/to/your/redis.conf")
  .build();

Or even create simple redis.conf file from scratch:

RedisServer redisServer = RedisServer.builder()
  .redisExecProvider(customRedisProvider)
  .port(6379)
  .slaveOf("locahost", 6378)
  .setting("daemonize no")
  .setting("appendonly no")
  .setting("maxheap 128M")
  .build();

Setting up a cluster

Our Embedded Redis has support for HA Redis clusters with Sentinels and master-slave replication

Using ephemeral ports

A simple redis integration test with Redis cluster on ephemeral ports, with setup similar to that from production would look like this:

public class SomeIntegrationTestThatRequiresRedis {
  private RedisCluster cluster;
  private Set<String> jedisSentinelHosts;

  @Before
  public void setup() throws Exception {
    //creates a cluster with 3 sentinels, quorum size of 2 and 3 replication groups, each with one master and one slave
    cluster = RedisCluster.builder().ephemeral().sentinelCount(3).quorumSize(2)
                    .replicationGroup("master1", 1)
                    .replicationGroup("master2", 1)
                    .replicationGroup("master3", 1)
                    .build();
    cluster.start();

    //retrieve ports on which sentinels have been started, using a simple Jedis utility class
    jedisSentinelHosts = JedisUtil.sentinelHosts(cluster);
  }
  
  @Test
  public void test() throws Exception {
    // testing code that requires redis running
    JedisSentinelPool pool = new JedisSentinelPool("master1", jedisSentinelHosts);
  }
  
  @After
  public void tearDown() throws Exception {
    cluster.stop();
  }
}

Retrieving ports

The above example starts Redis cluster on ephemeral ports, which you can later get with cluster.ports(), which will return a list of all ports of the cluster. You can also get ports of sentinels with cluster.sentinelPorts() or servers with cluster.serverPorts(). JedisUtil class contains utility methods for use with Jedis client.

Using predefined ports

You can also start Redis cluster on predefined ports and even mix both approaches:

public class SomeIntegrationTestThatRequiresRedis {
  private RedisCluster cluster;

  @Before
  public void setup() throws Exception {
    final List<Integer> sentinels = Arrays.asList(26739, 26912);
    final List<Integer> group1 = Arrays.asList(6667, 6668);
    final List<Integer> group2 = Arrays.asList(6387, 6379);
    //creates a cluster with 3 sentinels, quorum size of 2 and 3 replication groups, each with one master and one slave
    cluster = RedisCluster.builder().sentinelPorts(sentinels).quorumSize(2)
                    .serverPorts(group1).replicationGroup("master1", 1)
                    .serverPorts(group2).replicationGroup("master2", 1)
                    .ephemeralServers().replicationGroup("master3", 1)
                    .build();
    cluster.start();
  }
//(...)

The above will create and start a cluster with sentinels on ports 26739, 26912, first replication group on 6667, 6668, second replication group on 6387, 6379 and third replication group on ephemeral ports.

Redis version

When not provided with the desired redis executable, RedisServer runs os-dependent executable enclosed in jar. Currently is uses:

However, you should provide RedisServer with redis executable if you need specific version.

License

Licensed under the Apache License, Version 2.0

Contributors

Changelog

0.6

  • Support JDK 6 +

0.5

  • OS detection fix
  • redis binary per OS/arch pair
  • Updated to 2.8.19 binary for Windows

0.4

  • Updated for Java 8
  • Added Sentinel support
  • Ability to create arbitrary clusters on arbitrary (ephemeral) ports
  • Updated to latest guava
  • Throw an exception if redis has not been started
  • Redis errorStream logged to System.out

0.3

  • Fluent API for RedisServer creation

0.2

  • Initial decent release

embedded-redis's People

Contributors

anthonyu avatar enisher avatar gnethercutt avatar jakubstuglik avatar kstyrc avatar stianl avatar turu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

embedded-redis's Issues

Support Older JDK versions

Using JDK 8 definitely has its niceties, but building with JDK 8 sets unnecessary limitations on who can use embedded Redis.

I'd really like to see JDK 6+ supported. If you agree, I'd be glad to put a PR together.

NOTE: Many claim that JDK 6 is EOL, but that isn't really true.

Add support a real Redis Cluster

As far as I figure out, Redis Cluster and "Redis master slave model (made by slaveof replication) with sentinel" are two different things. So we can not enable cluster mode on second one. Two make a real Redis Cluster (which compatible with JedisCluster), we need "create" N nodes and "start"(configure) it.

Suggestion steps:

Create N nodes.

For each:

../../src/redis-server --port $PORT --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --appendonly yes --appendfilename appendonly-${PORT}.aof --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes
Setting up cluster

Using Jedis cluster functions similar to redis-trib.rb

Additional stuff

"Watch" functionality

For each:

../../src/redis-cli -p $PORT cluster nodes | head -30

Release to maven central.

Hi,

would it be possible to release the artifacts to maven central? My build has tons of dependencies and I don't really like adding a new repository.

Incorrect process name when started on mac.

I am starting redis embedded as part of spring-boot application(which is a product).
However after starting the redis instead of my product name I see redis in the tab.

I am starting embedded tomcat, solr, and redis... however the tab stays saying redis

see attached screenshot
screen shot 2015-04-14 at 14 02 14

redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream

It does not seem possible to start and stop the embedded redis database within separate, isolated unit tests that implement redislabs' Spark Redis.

The second unit test below fails with: redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream

import com.holdenkarau.spark.testing.SharedSparkContext
import com.redislabs.provider.redis.{RedisConfig, RedisEndpoint}
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{BeforeAndAfterEach, FlatSpec, Matchers}
import redis.embedded.RedisServer

@RunWith(classOf[JUnitRunner])
class RedisSpec extends FlatSpec with SharedSparkContext with BeforeAndAfterEach with Matchers {
  
  "first test" should "connect and close redis" in {
    val redisEmbedded = new RedisServer(6379)
    redisEmbedded.start()
    val redisConfig = new RedisConfig(new RedisEndpoint("localhost", 6379))
    redisEmbedded.stop()
  }

  "second test" should "also connect and close redis" in {
    val redisEmbedded = new RedisServer(6379)
    redisEmbedded.start()
    // fails here:
    val redisConfig = new RedisConfig(new RedisEndpoint("localhost", 6379))
    redisEmbedded.stop()
  }
}

This issue is also captured here for similar contexts:
#31
http://stackoverflow.com/questions/28737107/redis-clients-jedis-exceptions-jedisconnectionexception-unexpected-end-of-strea

Logs for redis server

Now logs of embedded server goes to nowhere. It is very inconvenient, when some issues come up you can't check redis logs to figure out what is the cause.

Running the server with command line argument that specifies path to log is not an option because in this case it doesn't send log to system output, but RedisServer expect logs there to check if it has been activated.

Unable to get redis-server.app to run on Mac OS X 10.7.5

RedisServer works beautifully if I specify the redis-server that I have installed locally. However, it does not start when relying on the embedded redis-server.app. If I copy the redis-server.app and try to run it directly, I get an error that the app is for the classic platform which is no longer supported by my version of the OS. Assuming this is the actual problem, is there any way you can bundle a newer version of the redis-server that will run on a modern Mac?

Thanks!

Licence - Ok to fork?

Hey Kstyrc,

We are currently testing out you embedded-redis in our tests, and it seems to work great. We would probably like to fork this before starting to use it ourselves however.

I can't find a license in this repo, so is it Ok for you if we fork this? Also, there seems to be a 0.6 version on MavenCental which differs from this version. Do you have the official repo in some other place than Github perhaps?

max heap setting does not work

I don't seem to have a locally-installed redis so it should be using the Linux 64-bit one inside the jar.

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 3
>>> 'maxheap 128M'
Bad directive or wrong number of arguments

Is it possible to save to disk?

I am trying to use this embedded-redis as a temporary storage for a small device, if I there is no internet connectivity. When the connection is back, the data is uploaded to server. But with this, if the device is rebooted, the data will be lost. Is it possible to save the data to the disk and delete only on demand ?

Connection refused

I'm getting Connection Refused when using it with Spring Session.
If I start Redis myself, it works fine, but embedded does not work.

Code:

@Configuration
public class EmbeddedRedisConfig {

@Bean
public static RedisServerBean redisServer() {
    return new RedisServerBean();
}

static class RedisServerBean implements InitializingBean, DisposableBean, BeanDefinitionRegistryPostProcessor {
    private RedisServer redisServer;

    public void afterPropertiesSet() throws Exception {
        redisServer = RedisServer.builder()
                .port(Protocol.DEFAULT_PORT)
                .setting("notify-keyspace-events Elg")
                .build();
        redisServer.start();
    }

    public void destroy() throws Exception {
        if(redisServer != null) {
            redisServer.stop();
        }
    }

    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {}

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {}
}

For some reason, I have to specify the .setting("notify-keyspace-events Elg"), else I get a:
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Unsupported CONFIG parameter: notify-keyspace-events

But that's not the problem, when i add that parameter, the next problem is that it wont connect.
I just get this: Caused by: java.net.ConnectException: Connection refused: connect

It's like it doesnt start when I add the setting("notify-keyspace-events Elg"), since usually I get the "Firewall warning" asking me if I want redis to gain access to the network. But that does not come when I specify the setting("notify-keyspace-events Elg").

Hanging thread on shutdown in Tomcat

The abstract Redis instance contains a single thread pool:

private final ExecutorService executor = Executors.newSingleThreadExecutor();

This creates a non daemon thread and there is no call to executor.shutdown() in the stop method.
As such this causes an appserver with an embedded redis server to hang.

Annoying alert when starting redis embedded.

When starting redis embedded as part of another applicaiton (spring boot in this case) i am getting each time a very very annoying alert message ( see screenshot for more details ).

And this is happening each time.. I do use solr embedded and elastic search embedded and tomcat and hazelcast but only redis shows this bad confirmation, none of the other asks me do I want to allow incoming connection.. this just looks very bad and basically makes redis unusable since it doesn't look very professional.

screen shot 2015-04-14 at 14 04 27

ERR wrong number of arguments for 'hmset' command

Hello,

I'm using your project and I think it's awesome, but sometimes (completely unpredictable) I get the following exception:

Stacktrace:] with root cause
redis.clients.jedis.exceptions.JedisDataException: ERR wrong number of arguments for 'hmset' command
    at redis.clients.jedis.Protocol.processError(Protocol.java:113)
    at redis.clients.jedis.Protocol.process(Protocol.java:138)
    at redis.clients.jedis.Protocol.read(Protocol.java:192)
    at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:282)
    at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:181)
    at redis.clients.jedis.BinaryJedis.hmset(BinaryJedis.java:722)
    at org.springframework.data.redis.connection.jedis.JedisConnection.hMSet(JedisConnection.java:2685)
    at org.springframework.data.redis.core.DefaultHashOperations$7.doInRedis(DefaultHashOperations.java:134)
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:191)
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:153)
    at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:86)
    at org.springframework.data.redis.core.DefaultHashOperations.putAll(DefaultHashOperations.java:131)
    at org.springframework.data.redis.core.DefaultBoundHashOperations.putAll(DefaultBoundHashOperations.java:85)
    at org.springframework.session.data.redis.RedisOperationsSessionRepository$RedisSession.saveDelta(RedisOperationsSessionRepository.java:409)
    at org.springframework.session.data.redis.RedisOperationsSessionRepository$RedisSession.access$000(RedisOperationsSessionRepository.java:331)
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.save(RedisOperationsSessionRepository.java:211)
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.save(RedisOperationsSessionRepository.java:141)
    at com.nemesis.platform.core.service.core.impl.SessionServiceImpl.setAttribute(SessionServiceImpl.java:78)
    at com.nemesis.platform.facade.url.resolver.impl.AbstractUrlResolver.resolve(AbstractUrlResolver.java:89)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:297)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
    at com.sun.proxy.$Proxy129.resolve(Unknown Source)
    at com.nemesis.platform.module.commerce.facade.category.populator.CategoryUrlPopulator.populate(CategoryUrlPopulator.java:37)
    at com.nemesis.platform.module.commerce.facade.category.converter.CategoryUrlConverter.populate(CategoryUrlConverter.java:51)
    at com.nemesis.platform.module.commerce.facade.category.converter.CategoryUrlConverter.populate(CategoryUrlConverter.java:26)
    at com.nemesis.platform.facade.converters.AbstractPopulatingConverter.convert(AbstractPopulatingConverter.java:60)
    at com.nemesis.platform.module.commerce.facade.category.impl.CategoryFacadeImpl.getCategoryForOptions(CategoryFacadeImpl.java:85)
    at com.nemesis.platform.module.commerce.facade.category.impl.CategoryFacadeImpl.getCategoryForCodeAndOptions(CategoryFacadeImpl.java:79)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:297)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
    at com.sun.proxy.$Proxy150.getCategoryForCodeAndOptions(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:297)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
    at com.sun.proxy.$Proxy150.getCategoryForCodeAndOptions(Unknown Source)
    at com.nemesis.platform.module.widget.categorylister.facade.converter.CategoryListerWidgetConverter.populate(CategoryListerWidgetConverter.java:61)
    at com.nemesis.platform.module.widget.categorylister.facade.converter.CategoryListerWidgetConverter.populate(CategoryListerWidgetConverter.java:34)
    at com.nemesis.platform.facade.converters.AbstractPopulatingConverter.convert(AbstractPopulatingConverter.java:60)
    at com.nemesis.platform.module.widget.common.facade.impl.CMSWidgetFacadeImpl.getSimpleCMSWidget(CMSWidgetFacadeImpl.java:91)
    at com.nemesis.platform.module.widget.common.facade.impl.CMSWidgetFacadeImpl.getWidgets(CMSWidgetFacadeImpl.java:110)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:297)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:52)
    at org.springframework.cache.interceptor.CacheAspectSupport.invokeOperation(CacheAspectSupport.java:320)
    at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:353)
    at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:302)
    at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
    at com.sun.proxy.$Proxy365.getWidgets(Unknown Source)
    at com.nemesis.platform.module.cms.storefront.tags.CMSContentSlotTag.prepare(CMSContentSlotTag.java:113)
    at com.nemesis.platform.module.cms.storefront.tags.CMSContentSlotTag.doStartTag(CMSContentSlotTag.java:153)
    at org.apache.jsp.WEB_002dINF.views.normal.pages.layout.solar.homepagetemplate_jsp._jspx_meth_cms_005fslot_005f2(homepagetemplate_jsp.java:291)
    at org.apache.jsp.WEB_002dINF.views.normal.pages.layout.solar.homepagetemplate_jsp.access$2(homepagetemplate_jsp.java:279)
    at org.apache.jsp.WEB_002dINF.views.normal.pages.layout.solar.homepagetemplate_jsp$Helper.invoke0(homepagetemplate_jsp.java:417)
    at org.apache.jsp.WEB_002dINF.views.normal.pages.layout.solar.homepagetemplate_jsp$Helper.invoke(homepagetemplate_jsp.java:443)
    at org.apache.jsp.tag.webnormal.template.page_tag$Helper.invoke2(page_tag.java:549)
    at org.apache.jsp.tag.webnormal.template.page_tag$Helper.invoke(page_tag.java:580)
    at org.apache.jsp.tag.webnormal.template.master_tag._jspx_meth_cms_005fbody_005f0(master_tag.java:371)
    at org.apache.jsp.tag.webnormal.template.master_tag.doTag(master_tag.java:235)
    at org.apache.jsp.tag.webnormal.template.page_tag._jspx_meth_template_005fmaster_005f0(page_tag.java:225)
    at org.apache.jsp.tag.webnormal.template.page_tag.doTag(page_tag.java:190)
    at org.apache.jsp.WEB_002dINF.views.normal.pages.layout.solar.homepagetemplate_jsp._jspx_meth_template_005fpage_005f0(homepagetemplate_jsp.java:160)
    at org.apache.jsp.WEB_002dINF.views.normal.pages.layout.solar.homepagetemplate_jsp._jspService(homepagetemplate_jsp.java:128)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:431)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:157)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:107)
    at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:59)
    at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112)
    at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:73)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.unic.demostore.storefront.filter.HiddenMethodWrapperFilter.doFilter(HiddenMethodWrapperFilter.java:50)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:69)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:157)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:168)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:68)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:152)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:184)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:860)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:305)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.nemesis.platform.core.filter.CorsFilter.doFilterInternal(CorsFilter.java:41)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:157)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:107)
    at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:111)
    at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:65)
    at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112)
    at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:73)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.unic.demostore.storefront.filter.RequestLoggerFilter.doFilterInternal(RequestLoggerFilter.java:80)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:102)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:149)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:168)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:152)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration$MetricsFilter.doFilterInternal(MetricFilterAutoConfiguration.java:92)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:673)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

I'm using java8, ubuntu and 0.6 of the embedded redis.

Improvements towards orphaned Redis processes

As it was mentioned in other issues here, embedded-redis leaves orphaned child processes when parent is aborted without RedisServer#stop(). Someone reported such behavior on CI servers, but for me this is happening when I stop debugging from IDE (IntelliJ) in the middle of a test case.

Currently auto-termination of child processes is unsolved problem in Java (stackoverflow). Hopefully that will be fixed once Java 9 is live (JEP-102). Until then I suggest a couple of improvements:

  1. Test if local port is available first and throw BindException if not. Let user define what to do in this case. In my case I've just decided to naively and blindly guess that there is already Redis up and running:
def isLocalPortAvailable(port: Int): Boolean = {
    var portAvailable = true
    var socket: ServerSocket = null
    try {
      socket = new ServerSocket(port)
    } catch {
      case e: BindException => portAvailable = false
    } finally {
      if (socket != null) {
        socket.close()
      }
    }
    portAvailable
  }
  1. Do not throw generic RuntimeException in AbstractRedisInstance, line 61. Just inherit something custom from runtime. It will be easier for end users to add custom handling logic
  2. Add Runtime.getRuntime().addShutdownHook logic as suggested in mentioned above stackoverflow, which will cover some cases of process termination, like SIGINT

Sould I see a unix process when Redis is started ?

Hi,

I was trying to connect to the embedded redis 0.1 from a unit test, but I can't connect using spring-data.

Should I see a running process on 6379 port when I start a Redis instance ? Or is it embedded in something else ?

I get ConnectionRefused exception on host:localhost and port:6379

Thank you

Further documentation to tell user not configure logfile

Today, I'm get stucks when starting application (Spring Boot) when trying to configure logfile option (I know this project not intent to be run in production system. But I think that it realiable enough to act as a cache store).

When log redirected to file, application will wait forever. So please document that to make easy of use.

Thanks!

max heap setting

will you be so kind to make it available to set the maxheap arg ?

packaged redis-server.exe wont start

When running the packaged windows binary that comes with the latest release, the following message is displayed:

The Windows version of Redis allocates a memory mapped heap for sharing with
the forked process used for persistence operations. In order to share this
memory, Windows allocates from the system paging file a portion equal to the
size of the Redis heap. At this time there is insufficient contiguous free
space available in the system paging file for this operation (Windows error
0x5AF). To work around this you may either increase the size of the system
paging file, or decrease the size of the Redis heap with the --maxheap flag.
Sometimes a reboot will defragment the system paging file sufficiently for
this operation to complete successfully.

Please see the documentation included with the binary distributions for more
details on the --maxheap flag.

Redis can not continue. Exiting.

This can be bypassed by adding the --maxheap option as suggested.

The config should be extended to be able to specify this argument when starting the server.

Abandoned?

Hi!

I need an embedded redis in one on my projects. I was just wondering if the support will continue for the current repository. If not, it would be good to find new maintainers.
I saw an active fork here https://github.com/fmonniot/embedded-redis
But its a no go for me since it does not provide embedded redis binaries nor spring support.

Thanks!

When running from a Spark job inside EMR, it can't find the redis resource

Spark runs on Yarn in EMR, and the default new RedisServer(port) constructor fails there with:

java.lang.IllegalArgumentException: resource redis-server-2.8.19 not found.
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:115)
    at com.google.common.io.Resources.getResource(Resources.java:152)

It seems URL url = loader.getResource(resourceName); results in url being null.

v0.2 doesnt have API described in README

The builder portion of the RedisServer class seems to have been introduced after you released v0.2 to the clojars repo. I had to build from source to 0.3 snapshot to get those goodies.
Can you release 0.3?

"Can't start redis server. Check logs for details" - which logs????

Caused by: java.lang.RuntimeException: Can't start redis server. Check logs for details.
    at redis.embedded.AbstractRedisInstance.awaitRedisServerReady(AbstractRedisInstance.java:61)
    at redis.embedded.AbstractRedisInstance.start(AbstractRedisInstance.java:39)
    at redis.embedded.RedisServer.start(RedisServer.java:9)
    at com.nemesis.platform.config.PlatformCoreSessionConfig$RedisServerBean.afterPropertiesSet(PlatformCoreSessionConfig.java:82)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:116)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)

The 0.6 version can't run on win32, how should i do?

The 0.6 version can't run on win32, how should i do?
the error message
The image file D:\Redis\embedded-redis-master\redis-server-2.8.19.exe is valid, but is for a machine type other than the current machine.

please Expose redis process path

currently in redis.embedded.util.JarUtil#extractExecutableFromJar()

import com.google.common.io.Files;
//skip
public class JarUtil {

    public static File extractExecutableFromJar(String executable) throws IOException {
        File tmpDir = Files.createTempDir();

Then in redis.embedded.RedisServer

    public RedisServer(Integer port) throws IOException {
        super(port);
        File executable = JarUtil.extractExecutableFromJar(RedisRunScriptEnum.getRedisRunScript());

then in redis.embedded.AbstractRedisInstance

    public synchronized void start() throws EmbeddedRedisException {
        if (active) {
            throw new EmbeddedRedisException("This redis server instance is already running...");
        }
        try {
            redisProcess = createRedisProcessBuilder().start();

and

    private ProcessBuilder createRedisProcessBuilder() {
        File executable = new File(args.get(0));
        ProcessBuilder pb = new ProcessBuilder(args);
        pb.directory(executable.getParentFile());
        return pb;
    }

So, as you can see, there is no way to read "executable" path outside of AbstractRedisInstance.

Is it possible to expose "executable" via getter at AbstractRedisInstance?

Sometimes (at least on windows) redis-server-64.exe is still running. I'm going to at least print the path of the executable to log, to be able to see later whether this subdirectory inside "java.io.tmpdir" was actually removed or not on exit.

Permissions denied while trying to start with another Redis installation

I was trying to init the embedded redis this way on mac. I am using the unstable version so I am pointing it into the dir which I installed it at:

/Users/idan/servers/redis-unstable/

Now in my test class:

@before
public void init() {
redisServer = new RedisServer(new File("/Users/idan/servers/redis-unstable/"), 6379);
redisServer.start();
}

I am getting this exception:

edis.embedded.exceptions.EmbeddedRedisException: Failed to start Redis instance
at redis.embedded.AbstractRedisInstance.start(AbstractRedisInstance.java:42)
at redis.embedded.RedisServer.start(RedisServer.java:9)
at com.zone.world_map_service_web.LocationServiceTest.init(LocationServiceTest.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.io.IOException: Cannot run program "/Users/idan/servers/redis-unstable" (in directory "/Users/idan/servers"): error=13, Permission denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at redis.embedded.AbstractRedisInstance.start(AbstractRedisInstance.java:37)
... 29 more
Caused by: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 30 more

I gave all permissions needed by chmod 777 recursive to the dir:

Idans-MBP:redis-unstable idan$ ls -la
total 240
drwxr-xr-x@ 21 idan staff 714 Aug 29 20:31 .
drwxr-xr-x 8 idan staff 272 Sep 11 18:27 ..
-rwxr-xr-x@ 1 idan staff 8196 Sep 12 10:31 .DS_Store
-rwxr-xr-x@ 1 idan staff 363 Aug 21 16:29 .gitignore
-rwxr-xr-x@ 1 idan staff 634 Aug 21 16:29 00-RELEASENOTES
-rwxr-xr-x@ 1 idan staff 53 Aug 21 16:29 BUGS
-rwxr-xr-x@ 1 idan staff 1569 Aug 21 16:29 CONTRIBUTING
-rwxr-xr-x@ 1 idan staff 1487 Aug 21 16:29 COPYING
-rwxr-xr-x@ 1 idan staff 11 Aug 21 16:29 INSTALL
-rwxr-xr-x@ 1 idan staff 4223 Aug 21 16:29 MANIFESTO
-rwxr-xr-x@ 1 idan staff 151 Aug 21 16:29 Makefile
-rwxr-xr-x@ 1 idan staff 6834 Aug 21 16:29 README.md
drwxr-xr-x@ 13 idan staff 442 Sep 12 10:31 deps
-rwxr-xr-x@ 1 idan staff 44471 Aug 21 16:29 redis.conf
-rwxr-xr-x@ 1 idan staff 271 Aug 21 16:29 runtest
-rwxr-xr-x@ 1 idan staff 280 Aug 21 16:29 runtest-cluster
-rwxr-xr-x@ 1 idan staff 281 Aug 21 16:29 runtest-sentinel
-rwxr-xr-x@ 1 idan staff 7109 Aug 21 16:29 sentinel.conf
drwxr-xr-x@ 172 idan staff 5848 Sep 9 16:21 src
drwxr-xr-x@ 12 idan staff 408 Aug 21 16:29 tests
drwxr-xr-x@ 17 idan staff 578 Aug 21 16:29 utils

Any idea?
Thanks.

Embed a more recent version of Redis

We use embedded-redis for testing and our samples. In one of our projects (https://github.com/spring-projects/spring-session), we also use Redis keyspace notifications, and therefore require Redis 2.8.0+.

Considering that Redis 2.8 was released in 2013, could you please add the binaries of a more recent Redis version? That would help use a lot!

I am aware that one can provide their own Redis binaries. But for testing and samples, I would need to provide versions for all 3 major platforms. This is a bit cumbersome right now - as it currently involves testing for those 3 platforms in my own code. I cannot even reuse some of the provided utility methods such as RedisRunScriptEnum#getRedisRunScript(), as it is private.

redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'CLUSTER'

In application code we set up cluster using JedisCluster and providing ip and port of one of the masters.
But in unit test when we set up RedisCluster as cluster = RedisCluster.builder().sentinelCount(0)
.serverPorts(group1.asJava).replicationGroup("master1", 1)
.build();
the tests are failing with
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'CLUSTER'
at redis.clients.jedis.Protocol.processError(Protocol.java:127)
at redis.clients.jedis.Protocol.process(Protocol.java:161)
at redis.clients.jedis.Protocol.read(Protocol.java:215)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340)
at redis.clients.jedis.Connection.getRawObjectMultiBulkReply(Connection.java:285)
at redis.clients.jedis.Connection.getObjectMultiBulkReply(Connection.java:291)
at redis.clients.jedis.Jedis.clusterSlots(Jedis.java:3376)
at redis.clients.jedis.JedisClusterInfoCache.discoverClusterNodesAndSlots(JedisClusterInfoCache.java:54)
at redis.clients.jedis.JedisClusterConnectionHandler.initializeSlotsCache(JedisClusterConnectionHandler.java:39)
at redis.clients.jedis.JedisClusterConnectionHandler.(JedisClusterConnectionHandler.java:17)
at redis.clients.jedis.JedisSlotBasedConnectionHandler.(JedisSlotBasedConnectionHandler.java:20)
at redis.clients.jedis.BinaryJedisCluster.(BinaryJedisCluster.java:48)
at redis.clients.jedis.JedisCluster.(JedisCluster.java:53)

So cluster command is not supported in embedded-redis ? Please let me know how to go abt testing JedisCluster with embedded redis.

Running on Jenkins glibc version not found

Hi

I can run this locally on my mac but once i check it in and run it on Jenkins, I see the following error message.

/tmp/1430170830037-0/redis-server-2.8.19: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /tmp/1430170830037-0/redis-server-2.8.19)

We are running with Spring 4.1.5 and Java 8

What are the OS dependencies?

The latest way of unpacking redis binary fails when one uses the project via an installed jar.

The latest way of unpacking redis binary fails when one uses the project via an installed jar. Here is the stacktrace:

java.io.FileNotFoundException: file:/Users/anthonyu/.m2/repository/redis/embedded/embedded-redis/1.0-SNAPSHOT/embedded-redis-1.0-SNAPSHOT.jar!/redis-server.app (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:138)
at com.google.common.io.Files$1.getInput(Files.java:99)
at com.google.common.io.Files$1.getInput(Files.java:97)
at com.google.common.io.ByteStreams.copy(ByteStreams.java:115)
at com.google.common.io.Files.copy(Files.java:229)
at com.google.common.io.Files.copy(Files.java:275)
at redis.embedded.RedisServer.extractExecutableFromJar(RedisServer.java:69)
at redis.embedded.RedisServer.(RedisServer.java:60)
at redis.clients.jedis.tests.JedisTestBase.setUp(JedisTestBase.java:24)
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:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Unexpected end of stream

at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:198)
[info] at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)
[info] at redis.clients.jedis.Protocol.process(Protocol.java:128)
[info] at redis.clients.jedis.Protocol.read(Protocol.java:192)
[info] at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:282)
[info] at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:181)
[info] at redis.clients.jedis.Jedis.watch(Jedis.java:1449)

Missing redis-server binaries for ppc64le platform causing testcase failure of presto-redis module.

Hi,

I am trying to port presto on ppc64le platform on Ubuntu 15.04, where getting test case failure on presto-redis module.

facing following errors:
[ERROR] Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectExcep tion: Connection refused
[ERROR] at redis.clients.jedis.Connection.connect(Connection.java:148)
[ERROR] at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:75)
[ERROR] at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1572)
[ERROR] at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:69)
[ERROR] at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:819)
[ERROR] at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:42 9)
[ERROR] at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:36 0)
[ERROR] at redis.clients.util.Pool.getResource(Pool.java:48)
[ERROR] ... 44 more
[ERROR] Caused by: java.net.ConnectException: Connection refused
[ERROR] at java.net.PlainSocketImpl.socketConnect(Native Method)
[ERROR] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
[ERROR] at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
[ERROR] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
[ERROR] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
[ERROR] at java.net.Socket.connect(Socket.java:589)
[ERROR] at redis.clients.jedis.Connection.connect(Connection.java:142)

After going through the source code, I identified that redis-server is being installed for the test execution from the jar embedded-redis-0.6.jar.
Since I am using Ubuntu 15.04 OS, it is trying to install redis-server from the location redis/2.8.9/linux/redis-server which is present inside 'embedded-redis-0.6.jar'.
I think this executable is generated for x86 platform and is not compatible for ppc64le.

so, could you please add support for the ppc64le architecture by adding binaries for redis-server of ppc64le platform.

Regards,
Naresh.

Running on Windows Server 2008

I have Jenkins installed on Windows Server 2008.
When I run my unit tests on local machine, I have success. But, when I run on Jenkins I have this error:

java.lang.RuntimeException: Can't start redis server. Check logs for details.
at redis.embedded.AbstractRedisInstance.awaitRedisServerReady(AbstractRedisInstance.java:61)
at redis.embedded.AbstractRedisInstance.start(AbstractRedisInstance.java:39)
at redis.embedded.RedisServer.start(RedisServer.java:9)
at teste.Main.main(Main.java:13)

The settings of RedisServer are the same.
What is wrong?
I try to show a complete log error, but I dont get.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.