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
"Can't start redis server. Check logs for details" - which logs???? #51
Comments
In the upcoming release I plan to expose redis logs to file, which you can inspect for issues. |
I got the exact same error with both 0.5 and 0.6. Windows 7 64 bits. If it's happening to you (dear reader) and you have no idea how to debug this until logs are indeed added to the application (thanks for your work btw) you can just do the following. Use your favorite IDE and create a very simple reproducer : public static void main(String... args) throws Exception {
RedisServer server = new RedisServer(6379);
server.start();
} Then in your favorite IDE, put a breakpoint here and debug the main method in your IDE. You should be able to read the error message from here. In my case, it was the following :
Which helped me a lot to diagnose the issue. Hope this helps someone one day. (this is actually issue #9 ) |
I'm also having the same issue. It's running fine on mac os x but when I run this under centos6.6 and redis-2.4 it throws this error
I have been spending a lot of time debugging this so a better logging mechanism would be really appreciated |
Hey sorry, it was because of the version of redis is too old. After I upgrade redis, everything works fine |
As my build is failing on Jenkins (still need to check if it is not #49) I have to ask when do you plan next release with logs? Keep up the good work! |
Same here for me, I get |
Using a redis-server build which was created on a CentOS System solved it for me. |
get the same running on snap-ci |
Same problem running in Circle CI. |
Turns out that Circle had it's own Redis instance using the same port. Just changing the port fixed it. |
on snap-ci I also started use the provided redis service, so no need to start an embedded one |
I am having the same error on my jenkins build running on Debian 4.8.4-1. Has there been any update here? I cannot install redis on the jenkins machine. This project is great! thank you! |
In my case, the problem was an already running instance of the Redis server (port already in use). Seems like one application shutdown went wrong and therefore failed to kill it. |
Yeah... this sometimes happens. What I do, which seems to work fine, is to start the redis server with a random port. That way, if the CI build fails to stop the redis server there's no problem since the new runs will have a different port. Also allows for safer concurrent builds since there are no conflicts. |
Any progress here? |
Hi I got the same issue . Simple what I did is just clear the C: disc and remove unnecessary program installed, clear desktop and clear recycle bin and increase the virtual memory . worked fined for me. |
Hey there! I was pulling my hairs to resolve :
error, finally I saw an instance of redis server is already running in background, So I killed that proccess and Re-rn the App and Yeah the App worked without that error. |
^ that. What I usually do, and it might not work for all use cases, is to always start the server with a random port. I can do this because I start/discard servers for every unit tests that needs them. |
C:\Users\ADMINI~1\AppData\Local\Temp\1469700558020-0\redis-server-2.8.19.exe |
path error:File executable = RedisExecProvider.defaultProvider().get(); |
public RedisServer(int port) throws IOException { |
C:\Users\Administrator>F:\it\redis\redis-server-2.8.19.exe Please see the documentation included with the binary distributions for more Redis can not continue. Exiting. |
Redis-x64-3.2.100.zip |
Build failing on Ubuntu 12.02, i686 (32 Bit) through Jenkins due to Same issue. Any updates on it? |
The problem lies in the following function awaitRedisServerReady() for me. There the startup input stream of redis is just ignored and parsed for the "ready" line only. But sometimes there is other important information logged into there, like the reason why the startup fails. So I need to debug this function to find out the actual reason. Would be nice if this stream would be logged somewhere and not just ignored. |
For me it worked after shifting it on 64 Bit Machine.. !! |
Thank @aesteve and @dalilagauge . On Windows 64-bit it works after setting maxheap. @Configuration
@Profile("test")
public class EmbeddedRedisServer {
@Value("${spring.redis.port:6380}")
private int redisPort;
private RedisServer redisServer;
@PostConstruct
public void startRedis() throws IOException, URISyntaxException {
//redisPort = org.springframework.util.SocketUtils.findAvailableTcpPort(6380);
//RedisExecProvider customRedisExec = RedisExecProvider.defaultProvider().override
// (OsArchitecture.detect().os(), OsArchitecture.detect().arch(), "redis-server-2.8.19.exe");
redisServer = RedisServer.builder()
.port(redisPort)
//.redisExecProvider(customRedisExec) //com.github.kstyrc (not com.orange.redis-embedded)
.setting("maxmemory 128M") //maxheap 128M
.build();
redisServer.start();
}
@PreDestroy
public void stopRedis() throws InterruptedException {
if (redisServer != null) {
redisServer.stop();
}
}
} hope this helps somebody someday, |
I am seeing this problem (on Arch Linux) in the outputLine of redisProcess: |
The same issue surfaces when creating a Cluster using sample code in README (with RedisCluster.builder()). However, the work-around of using custom settings, like @ducquoc suggested, doesn't work, since RedisClusterBuilder#buildMaster and RedisClusterBuilder#buildSlaves invoke builder.reset, hence passing configured RedisServerBuilders to RedisClusterBuilder effectively does nothing. What worked for me was to subclass RedisServerBuilder like so: class CustomClusterRedisServerBuilder extends RedisServerBuilder {
@Override
void reset() {
def confBuilderField = this.class.superclass.declaredFields.find {it.name == 'redisConfigBuilder'}
confBuilderField.setAccessible(true)
def oldConfBuilder = confBuilderField.get(this)
super.reset()
confBuilderField.set(this, oldConfBuilder)
}
} This is effectively a hack, which only works when you use custom settings, like I did. If you omit resetting entirely, though, you will end up with masters being slaves to other masters (since the configuration object is reused). and then use it when building a cluster: RedisCluster.builder()
.sentinelPorts(redisSentinels) //btw, order counts here, if you set ports after setting replication groups
.serverPorts(redisHosts) //you will get different ports. Go figure
.withServerBuilder(new CustomClusterRedisServerBuilder().setting("maxmemory 128").setting("maxheap 128M")) //same goes for settings
.withSentinelBuilder(RedisSentinel.builder().setting("maxmemory 128").setting("maxheap 128M"))
.sentinelCount(3)
.quorumSize(2)
.replicationGroup("master1", 1)
.replicationGroup("master2", 1)
.replicationGroup("master3", 1)
.build() Hope that helps somebody. Please note - I use this setup for tests, so this code could theoretically have ramifications if used for other purposes. |
|
Well in my case I was running embedded redis-server on port 1337 and this port was locked and went into a loop sometime back when I was running my testcases in debug mode. After that I also started spring-boot app which created another server connection on the port 6379. But I failed to terminate the server running on the port 1337. Since then I had been getting the exception when I was trying to execute test cases "Can't start redis server. Check logs for details.", since 1337 was locked. Debugging line-my-line "AbstractRedisInstance" class and "awaitRedisServerReady" method revealed "1337 Already in use" which was never logged at all. Killed this port and re-run testcases, everything was good. Hope this helps |
Hello, I am using Embedded Redis for running my JUnit Tests. All the tests are passing locally but when I try to run them on a Jenkins Server then they fail with error below (same as mentioned by @looser990) : Also I am not able to find the root cause. I even tried providing a specific range of random ports which are neither reserved nor used. But it did not help. Is there anything else which I can try to make sure that I am able to debug on Jenkins instance?
To add one more detail. The Redis version is
as dependency in my Maven POM. |
See also #77 which suggests that |
I fixed it after tons of trying with the way below, now thank me:):
|
When you are trying to restart RedisServer for example between RestController test and Service test which are using cache, you are getting this error : "Can't start redis server. Check logs for details." |
Hello people! org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embededRedis': Invocation of init method failed; nested exception is java.lang.RuntimeException: Can't start redis server. Check logs for details. Interesting that when the docker is active, redis does not work. |
Probably conflicting ports. Check this answer to setup a minimal reproducer, then add a break-point. When the break point is hit and your application pauses: in your debugger you should be able to inspect the root cause. (as stated above). Probably docker && embeddedRedis are using the same port. But by using your debugger you should be able to know. |
Im facing the same problem. Please let me know if you're able to resolve the issue. |
For me it helped to boot my Win10. |
This resolves the issue: kstyrc#51 While resolving logs at the process level is preferred as specified in the pull-request: kstyrc#113 - this fix takes a much more conservative approach and prints the redis process logs only in case of an error/exception when the server startup pattern is not found. That way we do not need to worry about logs in case of successful redis server starts.
This resolves the issue: kstyrc#51 While resolving logs at the process level is preferred as specified in the pull-request: kstyrc#113 - this fix takes a much more conservative approach and prints the redis process logs only in case of an error/exception when the server startup pattern is not found. That way we do not need to worry about logs in case of successful redis server starts. Dist updated to trusty to resolves travis jdk8 build issue caused by xenial dist Removed sudo and curl commands as they are not longer supported. jpm4j is not longer functional and sudo is deprecated in travis
Resolved the issue to print the log of redis process when there is an error in the PR (merged): ozimov#10 You can find this once @robertotru releases the next version - i.e. - 0.7.3+ |
this works for me!! |
Just using a different port worked for me |
Just change port of redis server in config yml ;) |
Well, i don't know if any one else hava the same problem, my problem was i didn't configure @activeprofiles("production") on my config reddis, i think this made an interference. |
For me, the server was already running as well |
I also encountered this problem. I saw that redis server was still running in the task manager and guessed that the port was occupied, so after modifying the code and testing, I manually called the stop method to close redisserver. |
It seems we should now be able to see the logs message in the exception, no ? But I see : |
it is 2023, and I still see the same message. |
"main@1" prio=5 tid=0x1 nid=NA runnable |
nearing 2024, problem still occurs Dockerfile is a simple:
This is supposed to build our app but the test step of gradle fails due to embedded redis not being able to succeed. |
I solved this by using |
The text was updated successfully, but these errors were encountered: