Bug #833
openCSD - Bind address error
0%
Description
Sometimes CSD quits with message "Adress already in use..."
Ldv-core will check address and then run csd. But between Ldv-core checks and
starting CSD adress is unused.
It may be possible if running more than one ldv-tools and second CSD starts before the first.
1. ldv-core1 - find_free_address - 8080 -> starting csd1 with 8080
2. ldv_core2 - find_free_address - 8080 -> starting csd2 with 8080
3. csd2 - try to bind address 8080 - Ok
4. csd1 - try to bind address 8080 - failed because adress 8080 already busy (by csd2)
Updated by Pavel Shved almost 14 years ago
A way to do it without races is like this. Do not first check, then start server with the port found. Just start server at once, and if it fails with "already in use" error, attempt to start it on the next port. This way you'll start a server without any races.
Then the server somehow informs the calling program about the port it's managed to bind to (via standard output, or a pid-based temp file), and the calling program connects to that port.
To make a workaround, you might just sleep for a random time before checking if the port's in use.
Updated by Alexandr Strakh almost 14 years ago
I will check the STDERR for a message "address already in use" in case of crash CSD. And then try to run CSD with new address.
Updated by Pavel Shved almost 14 years ago
Alexandr Strakh wrote:
I will check the STDERR for a message "address already in use" in case of crash CSD. And then try to run CSD with new address.
Ok, but make sure you'll still show other error messages to user. Don't forget to add comments about that!
Updated by Pavel Shved almost 14 years ago
- Assignee changed from Alexandr Strakh to Pavel Shved
Reassigning Alexander's bugs, due to his transfer to the other project.
Updated by Pavel Shved over 13 years ago
- Status changed from New to Rejected
This is good old "Bind address error" from bug #833. Night tests were running simultaneously with tests for the new commits in master.
Closing as a duplicate.
Updated by Pavel Shved over 13 years ago
- Status changed from Rejected to Open
- Priority changed from Normal to High
... now that was as stupid race condition bug in Redmine...
Updated by Pavel Shved over 13 years ago
Updated by Pavel Shved over 13 years ago
- Priority changed from High to Normal
It will become less urgent when we'll make QA server not require builds for each commit.
Updated by Alexey Khoroshilov almost 13 years ago
The right solution is proposed above:
Pavel Shved wrote:
if ldv-core was the server, and CSD was the client, not vice versa...
For now, trying to reduce probability of the race, I have committed a patch to select random ports from 8080 to 8099 instead of predefined sequence starting from 8080.
Updated by Evgeny Novikov almost 13 years ago
I don't know internals, but can't we "lock" a found address at the same time when it's found? In this case other ldv-core instances will find other addresses...
Updated by Evgeny Novikov over 11 years ago
- Category deleted (
Infrastructure) - Assignee changed from Pavel Shved to Ilja Zakharov
Please, read it thoroughly!