# Timeout when migrating database after updating to 1.6.0.278

**URL:** https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984
**Category:** Bugs
**Created:** [July 15, 2015, 9:50am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984 "2015-07-15T09:50:49Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![chillefeld](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/chillefeld/32/1333_2.png) [@chillefeld](https://www.finalbuilder.com/forums/u/chillefeld)
#### Post date: [July 15, 2015, 9:50am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/1 "2015-07-15T09:50:49Z")

</div>

I tried updating our Continua installation to 1.6.0.278 but when starting the service afterward I get a database timeout. Continua’s debug log looks like this:  
  
Medium: 09:40:58 {T4} [Debug] [Logging] Cleaning up existing logs which are older then 7 days.  
Medium: 09:40:58 {T4} [Startup] Starting Continua version 1.6.0.278.  
Medium: 09:45:00 {T4} [Database] Could not initialise database:  
  
System.Exception: An error occurred executing the following sql:  
update builds\_unittest set assemblyname = LEFT(assemblyname, 256)  
The error was FEHLER: 57014: storniere Anfrage wegen Zeitüberschreitung der Anfrage  
&nbsp;—\> Npgsql.NpgsqlException: FEHLER: 57014: storniere Anfrage wegen Zeitüberschreitung der Anfrage  
&nbsp;&nbsp; at Npgsql.NpgsqlState.d\_\_0.MoveNext()  
&nbsp;&nbsp; at Npgsql.ForwardsOnlyDataReader.GetNextResponseObject(Boolean cleanup)  
&nbsp;&nbsp; at Npgsql.ForwardsOnlyDataReader.GetNextRowDescription()  
&nbsp;&nbsp; at Npgsql.ForwardsOnlyDataReader.NextResultInternal()  
&nbsp;&nbsp; at Npgsql.ForwardsOnlyDataReader…ctor(IEnumerable`1 dataEnumeration, CommandBehavior behavior, NpgsqlCommand command, NotificationThreadBlock threadBlock, Boolean preparedStatement, NpgsqlRowDescription rowDescription)<br>&nbsp;&nbsp; at Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb)<br>&nbsp;&nbsp; at Npgsql.NpgsqlCommand.ExecuteNonQuery()<br>&nbsp;&nbsp; at FluentMigrator.Runner.Processors.Postgres.PostgresProcessor.Process(String sql)<br>&nbsp;&nbsp; --- End of inner exception stack trace ---<br>&nbsp;&nbsp; at FluentMigrator.Runner.Processors.Postgres.PostgresProcessor.Process(String sql)<br>&nbsp;&nbsp; at FluentMigrator.Runner.StopWatch.Time(Action action)<br>&nbsp;&nbsp; at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection`1 expressions)  
&nbsp;&nbsp; at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp(IMigrationInfo migrationInfo, Boolean useTransaction)  
&nbsp;&nbsp; at FluentMigrator.Runner.MigrationRunner.MigrateUp(Boolean useAutomaticTransactionManagement)  
&nbsp;&nbsp; at FluentMigrator.Runner.Initialization.TaskExecutor.Execute()  
&nbsp;&nbsp; at Continua.Migrations.Runner.Execute(String database, String connectionString, String fileName)  
&nbsp;&nbsp; at Continua.Server.Service.Migrator.Begin()  
Exiting…  
Medium: 09:45:00 {T4} [Startup] Application is Errored  
  
Hope this gets resolved quickly.  
  
Regards,  
Christoph

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [July 15, 2015, 10:42am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/2 "2015-07-15T10:42:14Z")

</div>

Hi Christoph,  
  
How big is the&nbsp;builds\_unittest table? Can you&nbsp;run &nbsp;

`SELECT` `COUNT``(*) ``FROM` `builds_unittest`

  
on your database?

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [July 15, 2015, 10:51am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/3 "2015-07-15T10:51:03Z")

</div>

Can you also try running

`update` `builds_unittest ``set` `assemblyname = ``LEFT``(assemblyname, 256)`

  
directly on the the database. You can do this using C:\Program Files\VSoft Technologies\ContinuaCI\Server\PostgreSQL\bin\pgAdmin3.exe. Use the connection details in&nbsp;C:\Program Files\VSoft Technologies\ContinuaCI\Server\Continua.Server.Service.exe.config under&nbsp;hibernate-configuration\session-factory\property name=“connection.connection\_string”

---

<div class="post-metadata">

### Author: ![chillefeld](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/chillefeld/32/1333_2.png) [@chillefeld](https://www.finalbuilder.com/forums/u/chillefeld)
#### Post date: [July 15, 2015, 11:28am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/4 "2015-07-15T11:28:01Z")

</div>

Ouch!   
 SELECT COUNT(\*) FROM builds\_unittest returns 40,852,35!. I aborted the update after 15 minutes.   
 I have now changed our unit tests clean up to also delete database entries. After that the count was reduced to about 108k. The update was done in about 62 seconds on the reduced data set.

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [July 15, 2015, 11:35am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/5 "2015-07-15T11:35:39Z")

</div>

Hi Christoph,  
  
Great that it works now. I’m just in the process creating a new build with a longer (10 minute) time out - but I guess that would not have been enough either!

---

<div class="post-metadata">

### Author: ![chillefeld](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/chillefeld/32/1333_2.png) [@chillefeld](https://www.finalbuilder.com/forums/u/chillefeld)
#### Post date: [July 15, 2015, 11:37am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/6 "2015-07-15T11:37:11Z")

</div>

After reducing the number of entries I was now also able to update to buid 278 successfully.

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [July 15, 2015, 11:52am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/7 "2015-07-15T11:52:00Z")

</div>

I’ve uploaded build 279 with a longer time out in case anyone else has similar problems. You can safety ignore it.

---

<div class="post-metadata">

### Author: ![christian.leh](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/c/67e7ee/32.png) [@christian.leh](https://www.finalbuilder.com/forums/u/christian.leh)
#### Post date: [July 23, 2015, 4:37am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/8 "2015-07-23T04:37:08Z")

</div>

we cannot upgrade, too. we still have the same problem with version 279.   
 we have about 53k rows using [code]SELECT COUNT(\*) FROM builds\_unittest[/code].

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [July 24, 2015, 1:48am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/9 "2015-07-24T01:48:16Z")

</div>

Hi Christian,  
  
Please try this version with improved migration code:  
  
[Continua CI (64-bit) v1.6.0.283.](http://downloads.finalbuilder.com/downloads/continua/1.6/ContinuaCI.Server.Setup_x64_1.6.0.283.exe)  
[Continua CI Agent Installer (64-bit) v1.6.0.283](http://downloads.finalbuilder.com/downloads/continua/1.6/ContinuaCI.Agent.Setup_x64_1.6.0.283.exe)  
  
[Continua CI (32-bit) v1.6.0.283.](http://downloads.finalbuilder.com/downloads/continua/1.6/ContinuaCI.Server.Setup_1.6.0.283.exe)  
[Continua CI Agent Installer (32-bit) v1.6.0.283](http://downloads.finalbuilder.com/downloads/continua/1.6/ContinuaCI.Agent.Setup_1.6.0.283.exe)  
  
If the problem persists, can you post the new error message.

---

<div class="post-metadata">

### Author: ![christian.leh](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/c/67e7ee/32.png) [@christian.leh](https://www.finalbuilder.com/forums/u/christian.leh)
#### Post date: [July 24, 2015, 9:10am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/10 "2015-07-24T09:10:15Z")

</div>

well, its still migrating since 45 minutes. very long time, but still doing something.

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [July 24, 2015, 9:15am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/11 "2015-07-24T09:15:06Z")

</div>

Hi Christian,  
  
That 's really unusual. Can you switch on debug logging, restart and send the log to [support@finalbuilder.com](mailto:support@finalbuilder.com)?

---

<div class="post-metadata">

### Author: ![christian.leh](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/c/67e7ee/32.png) [@christian.leh](https://www.finalbuilder.com/forums/u/christian.leh)
#### Post date: [July 24, 2015, 9:23am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/12 "2015-07-24T09:23:06Z")

</div>

i’ll do this. for now, this is what is shown during startup:   
  
 08:22 : Starting   
 08:22 : Migrating Database   
 09:11 : Could not initialise database: An error occurred executing the following sql: ALTER TABLE public.builds\_unittest ALTER assemblyname TYPE varchar(256), ALTER assemblyname SET NOT NULL The error was FEHLER: 57014: storniere Anfrage wegen Zeitüberschreitung der Anfrage Check the eventlog for more info.   
  
 simply a database timeout (the german part at the end).

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [July 24, 2015, 9:54am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/13 "2015-07-24T09:54:28Z")

</div>

Can you try running that command:

`ALTER` `TABLE` `builds_unittest ``ALTER` `assemblyname TYPE ``varchar``(256)`

  
directly on the database?  
  
It shouldn’t be taking that long. Maybe the database needs some maintenance. Can you try running the following:  
  

`VACUUM ANALYSE builds_unittest`

  
if &nbsp;this doesn’t improve it then run:  
  

`REINDEX TABLE builds_unittest`

---

<div class="post-metadata">

### Author: ![christian.leh](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/c/67e7ee/32.png) [@christian.leh](https://www.finalbuilder.com/forums/u/christian.leh)
#### Post date: [July 24, 2015, 10:45am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/14 "2015-07-24T10:45:24Z")

</div>

some stats about this table from pgAdmin:   
 active tupel: 17552056 (my previous number 53k was just the last part of the real number forgot to resize the colum in pgAdmin ;-))   
 table size: 4GB   
 index size: 16GB   
  
 in general, the size of index in the whole database is very big ☹ well, i should check the clean up rules for old builds. maybe we can tweak something here. is it possible to remove the test results itself but keep the stats or does delete database entries everything?   
  
 can i clean up the table builds\_unittest by hand so the update can proceed? currently i have no working installation. not tried to restore yet.

---

<div class="post-metadata">

### Author: ![christian.leh](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/c/67e7ee/32.png) [@christian.leh](https://www.finalbuilder.com/forums/u/christian.leh)
#### Post date: [July 24, 2015, 11:02am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/15 "2015-07-24T11:02:04Z")

</div>

ok, i just truncated the unit test table then it worked instantly. now i’ve changed our clean up policies to also delete database entries so i think this will avoid the problem in future even if we lose statistics then (as the documentation says).

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [July 27, 2015, 7:06am UTC](https://www.finalbuilder.com/forums/t/timeout-when-migrating-database-after-updating-to-1-6-0-278/5984/16 "2015-07-27T07:06:41Z")

</div>

Hi Christian,  
  
Great that it’s up and working now. One effect of truncating the unit test table is that the results are not displayed on the unit tests tab for the build (the totals will still be displayed). Another effect will be that all failures in the next build will be displayed as new failures.  
  
We plan to allow more fine tuned database clean-up in the future to allow the unit test results to be cleaned up separately. We also plan to ensure that builds can be cleaned up without effecting statistics.
