The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

If a Version 12 server is started with two databases specified on the command line, and one of those databases contains a DatabaseStart event containing code to connect to the other database via remote data access (proxy tables), is it possible that attempt will fail because the other database hasn't started yet?

Or is it guaranteed that the DatabaseStart will not run until the other database specified on the command line has actually started and is accepting connections?

Or (just as good) will the connection attempt silently wait until the other database is up and running, rather than fail?

Yes, I could test this, and I will... but it could be a timing-related issue; i.e., something that works in test but fails under load... a Bohrbug :)

asked 31 Jul '11, 06:58

Breck%20Carter's gravatar image

Breck Carter
accept rate: 21%

Short answer: there is no guarantee of the ordering of events during startup and therefore you should look to using other methods such as retry loop in your DatabaseStart event when trying to connect to another database that is starting at the same time.

The longer answer:

Starting a database server is a complex sequence of operations but when it comes to starting the databases which have been specified on the command line all databases are scheduled to be started at the same time. "Scheduled" here means that a request is put into the queue for each database that is mentioned on the command line thus causing each database to be started asynchronously with respect to the other databases.

Starting up a database is also a very complex sequence of operations but it starts when a worker thread picks up the request that has been queued. After lots of checks and recovery (if needed) has been completed then provided no errors occurred the DatabaseStart event for the database will be executed.

So hopefully from the above you can see that the executing of the DatabaseStart event on each database is not dependent of the state of the other databases that are starting at the same time and therefore you are not guaranteed that (in your case) the second database will be up prior to the first database DatabaseStart event executing.

So let us now address the issue of the connection between the first and second database. If the connection attempt is made prior to the database being ready to accept connections then the connection attempt will likely fail. I say "likely" because if you are using TCP/IP then (depending on your connection string) there could be up to a ~5 second delay while the location of the remote server/database is being discovered (via UDP packets being sent out). This delay may be sufficient to let the second database get to the state that it can accept connections.... but there is no guarantee that it will be.

permanent link

answered 31 Jul '11, 08:41

Mark%20Culp's gravatar image

Mark Culp
accept rate: 40%

Thanks! ...the way you describe it, there is a real potential for a Bohrbug where it works 100% of the time in development and testing and fails in the hands of the first end user :)

(31 Jul '11, 09:43) Breck Carter
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 31 Jul '11, 06:58

question was seen: 523 times

last updated: 31 Jul '11, 09:43