Project

General

Profile

Bug #833

CSD - Bind address error

Added by Alexandr Strakh about 8 years ago. Updated over 5 years ago.

Status:
Open
Priority:
Normal
Assignee:
Category:
-
Start date:
02/11/2011
Due date:
% Done:

0%

Estimated time:
Detected in build:
81276a85d508846da2f7f87ab6728d9b5d3f5661
Platform:
Published in build:

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)


Related issues

Has duplicate Linux Driver Verification - Bug #976: ldv-core fails on qa because of conflict on some addressClosed2011-03-25

Is duplicate of Linux Driver Verification - Bug #1134: CSD fails again!Rejected2011-04-25

Blocks Linux Driver Verification - Feature #1261: Automatically prepare builds of development branches each nightNew2011-05-21

History

#1 Updated by Pavel Shved about 8 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.

#2 Updated by Alexandr Strakh about 8 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.

#3 Updated by Pavel Shved about 8 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!

#4 Updated by Pavel Shved about 8 years ago

  • Assignee changed from Alexandr Strakh to Pavel Shved

Reassigning Alexander's bugs, due to his transfer to the other project.

#5 Updated by Pavel Shved almost 8 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.

#6 Updated by Pavel Shved almost 8 years ago

  • Status changed from Rejected to Open
  • Priority changed from Normal to High

... now that was as stupid race condition bug in Redmine...

#7 Updated by Pavel Shved almost 8 years ago

Just to not forget.

On my way home I realized one important thing, inspired by comment 4 to bug #974. This issue with race condition in address assignment would be much easier to solve if ldv-core was the server, and CSD was the client, not vice versa...

#8 Updated by Pavel Shved almost 8 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.

#9 Updated by Alexey Khoroshilov about 7 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.

#10 Updated by Evgeny Novikov about 7 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...

#11 Updated by Evgeny Novikov over 5 years ago

  • Category deleted (Infrastructure)
  • Assignee changed from Pavel Shved to Ilja Zakharov

Please, read it thoroughly!

Also available in: Atom PDF