# Crash starting build after service restart

**URL:** <https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405>\
**Category:** Bugs\
**Tags:** fixed\
**Created:** [January 29, 2019, 11:39pm UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405 "2019-01-29T23:39:42Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [January 30, 2019, 5:35am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/21 "2019-01-30T05:35:08Z")

</div>

There’s really not much we can do about this. We have looked at ways to reduce the memory usage when capturing process output, unfortunately the .net framework doesn’t make that easy. We’ll tkae another look at it.

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [January 30, 2019, 5:38am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/22 "2019-01-30T05:38:20Z")

</div>

From memory the filtering is done after the list, as it uses regular expressions. Unfortunately subversion is pretty limited when it comes to listing branches and filtering on the command line (ie zero functionality). Git and Mercurial at least have built in functionality to list the branches.

---

<div class="post-metadata">

**Author:** ![karmasponge](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/4491bb/32.png) [@karmasponge](https://www.finalbuilder.com/forums/u/karmasponge)\
**Post date:** [January 30, 2019, 5:39am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/23 "2019-01-30T05:39:58Z")

</div>

So its caching the entire list output in memory? Can’t stream to temp file? Seems odd that it does not apply the filter when reading from the output buffer. Most of the folders under /newlook/branches’ (~80%) is skipped by the repository filter.

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [January 30, 2019, 5:44am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/24 "2019-01-30T05:44:50Z")

</div>

That’s something we’ll have to look at, the output comes in chunks, not always complete lines, so parsing on the fly is a bit more complicated. It is something we know about, but it hasn’t been an issue until now.

---

<div class="post-metadata">

**Author:** ![karmasponge](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/4491bb/32.png) [@karmasponge](https://www.finalbuilder.com/forums/u/karmasponge)\
**Post date:** [January 30, 2019, 5:49am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/25 "2019-01-30T05:49:04Z")

</div>

I pretty sure you that .net will buffer output from a command line. Since ‘svn list’ command outputs one entry per line I would have thought it would be relatively straight forward to wait for a line and then run a pre-compiled reg-ex over it (discarding unmatched lines).

I however don’t know any of your internals, I’m merely speculating.

I guess Ill have to try bumping the memory on the machine and hope its enough.

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [January 30, 2019, 5:49am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/26 "2019-01-30T05:49:16Z")

</div>

There are always things we could do better, but with limited resources we have to pick our battles.

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [January 30, 2019, 6:17am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/27 "2019-01-30T06:17:46Z")

</div>

I had a look at the code, we use

```
process.StandardOutput

```

and

```
process.StandardError

```

which are read inside threads. They are [StreamReader](https://docs.microsoft.com/en-us/dotnet/api/system.io.streamreader?view=netframework-4.7.2)s, which does have a ReadLine method, however when reading large volumes of output the performance is terrible. To work around that, we call .Read with an 8K buffer and build up the output string.

Looking at this code, there’s definitely an opportunity to improve things here, but it will take some major refactoring, which is not without risk. I’ll discuss this with the lead dev (Dave) when he returns from leave.

---

<div class="post-metadata">

**Author:** ![karmasponge](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/4491bb/32.png) [@karmasponge](https://www.finalbuilder.com/forums/u/karmasponge)\
**Post date:** [January 30, 2019, 6:55am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/28 "2019-01-30T06:55:33Z")

</div>

Unfortunately changing the memory limit of the server to 4GB does not resolve the issue ☹

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [January 30, 2019, 9:10pm UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/29 "2019-01-30T21:10:49Z")

</div>

Ok, we will need a debug log so we can see where it’s failing. A diagnostics report would also be useful so we can see what settings you have. Hopefully we can set up a scenario to reproduce it here first, and profile to see exactly where the memory usage is.

---

<div class="post-metadata">

**Author:** ![karmasponge](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/4491bb/32.png) [@karmasponge](https://www.finalbuilder.com/forums/u/karmasponge)\
**Post date:** [January 30, 2019, 11:11pm UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/30 "2019-01-30T23:11:43Z")

</div>

I’m thinking that our ‘/branches/peercodereviews’ folder is probably why this operation is choking. We almost daily add new folders (which are branches of trunk) to this folder. It’s possible that we hit some threshold where it takes too much memory to read all the file names into memory. Seems possible the initial failure may have caused Continua to reset that repository and otherwise we may not have seen this issue?

Ill start collecting logs/diagnostics.

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [January 30, 2019, 11:23pm UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/31 "2019-01-30T23:23:49Z")

</div>

I did wonder why it was resetting the repo in the first place. That said, we’re looking at the code today with the hope of finding some ways to decrease memory usage.

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [January 31, 2019, 5:50am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/32 "2019-01-31T05:50:35Z")

</div>

Hi Simon

I spent most of today looking at this, and attempting to rectify, but it’s going to take a while.

The code in question is used literally everywhere and the risk of breaking unrelated things with a quick fix is very high. Hopefully we’ll have something by the end of next week. In the mean time, I can only suggest temporarily increasing the memory on the vm until it gets past the repo reset phase.

---

<div class="post-metadata">

**Author:** ![karmasponge](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/4491bb/32.png) [@karmasponge](https://www.finalbuilder.com/forums/u/karmasponge)\
**Post date:** [January 31, 2019, 5:59am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/33 "2019-01-31T05:59:11Z")

</div>

I’ve captured a log at time of crash plus diagnostics.

I’ve tried bumping the machine to 4GB however the Continua service hits ~2.5 GB and then crashes.

In the interim were going to disable the failing repository so that we can a -least perform some builds.

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [January 31, 2019, 6:05am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/34 "2019-01-31T06:05:09Z")

</div>

Thanks, I have removed the attachment since it has email addresses in the log!

This is all we need for now I think.

---

<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:** [February 8, 2019, 6:40am UTC](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405/35 "2019-02-08T06:40:50Z")

</div>

This issue has now been fixed in [version 1.9.0.337](https://www.finalbuilder.com/downloads/continuaci/continua-ci-version-history-v19)

[Previous page](https://www.finalbuilder.com/forums/t/crash-starting-build-after-service-restart/6405.md?page=1)
