-
Notifications
You must be signed in to change notification settings - Fork 197
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
Binding failed #61
Comments
I assume that port is free? |
Yes, |
It would be good to have some more logging :) Can you try running the server with
|
Ok, I've added the debug logging but it doesn't seem to add any more logging when the errors occur. I'm also seeing this error. I either get the first error or this one. I have not seen both happen at the same time. Error Message
Stacktrace
Standard Output
|
I was also using v0.8.8. I will update to the latest and see if failures still occur. Update: they still occur with v0.8.12 |
10s waiting for bind to complete is quite a long time ... is this happening when you frequently start/stop the server? Though the port should be freed quickly after being released I guess |
We are using elasticmq for testing our service's features that depend on an AmazonSQS Queue. Our tests logic basically boils down to this:
Our current test suite only starts/stops one SQS server once per run of the test suite. The only thing that I think could cause a problem is if the SQS server is not shutdown correctly. The following snippets are the logs of after shutting down the server and the implementation of the test suite. Do you see any implementation issues?
public abstract class TestBase extends Base {
private SQSRestServer sqsRestServer;
@BeforeClass
public void beforeClass()
throws Exception {
startSQS();
}
@AfterMethod
public void afterMethod()
throws Exception {
clearSQS();
}
@AfterClass
public void afterClass()
throws Exception {
stopSQS();
}
private void startSQS() {
sqsRestServer = SQSRestServerBuilder.withPort(TestEnvironment.getSqsPort().get()).withInterface(TestEnvironment.getSqsHost().get()).start();
sqsRestServer.waitUntilStarted();
getAmazonSQS().createQueue(new CreateQueueRequest(TestEnvironment.getSqsName().get())
.withAttributes(ImmutableMap.of("VisibilityTimeout", Integer.toString(getConfiguration().getEtlConfiguration().getReceiveVisibilityTimeoutSeconds()))));
}
private void clearSQS() {
final long START_TIME = System.currentTimeMillis();
final long MIN_TIME = getConfiguration().getEtlConfiguration().getReceiveVisibilityTimeoutSeconds();
// Poll for at least a certain amount of time and keep polling if there are still messages in the queue
final Set<Message> messages = Sets.newHashSet();
while (!receiveMessage().getMessages().isEmpty() && (System.currentTimeMillis() - START_TIME) < MIN_TIME) {
messages.addAll(receiveMessage().getMessages());
}
// Delete all messages found in the queue
for (final Message message : messages) {
getAmazonSQS().deleteMessage(
getConfiguration().getAwsConfiguration().getQueueURL(),
message.getReceiptHandle());
}
}
private void stopSQS() {
getAmazonSQS().deleteQueue(getConfiguration().getAwsConfiguration().getQueueURL());
sqsRestServer.stopAndWait();
}
protected SendMessageResult sendMessage(final String body) {
return getAmazonSQS().sendMessage(
getConfiguration().getAwsConfiguration().getQueueURL(),
getGson().toJson(ImmutableMap.of("Message", body)));
}
protected ReceiveMessageResult receiveMessage() {
return getAmazonSQS().receiveMessage(getConfiguration().getAwsConfiguration().getQueueURL());
}
} |
Yeah that looks correct ... btw there's a |
Could you check 0.9.0-beta1? (https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-0.9.0-beta1.jar) It uses a new HTTP backend so maybe something will change here. |
@adamw was this a proven fix for this? |
@st9x3st9 Are you still seeing this also with 0.9.0-beta1? |
Would be nice if there was a solution, I'm getting what appears the same on 0.14. |
Does anybody know of a solution for this? Running on 0.14.6 |
Same problem for 0.14.7 (Embedded ElasticMQ) |
Seeing this as well, I think the server started by one test does not get shut down properly and then a later test that tries to create a new one gets I noticed the tests in the repo mention something similar: |
Same problem |
@pliuchkin which version, and how are you exactly starting elasticmq? |
I do not know if its related, or if I should open another bug, but the symptoms is kind of the same, so will try here first. But I also sometimes get an error when starting it. But for me it is related to the Mbean:
Looks like it happens in tests, where the server is booted up, and shutdown multiple times. I have for now worked around it, by catching the exception, waiting a second and then try again. |
@Kreinoee I think that's a separate issue, so please open a new one :) |
Error Message
Stacktrace
Standard Output
The text was updated successfully, but these errors were encountered: