# Why does the number of instances of a pooled service drop below the initial pool size

**URL:** https://talk.remobjects.com/t/why-does-the-number-of-instances-of-a-pooled-service-drop-below-the-initial-pool-size/33895
**Category:** Data Abstract
**Tags:** net
**Created:** [August 31, 2026, 3:23pm UTC](https://talk.remobjects.com/t/why-does-the-number-of-instances-of-a-pooled-service-drop-below-the-initial-pool-size/33895 "2026-08-31T15:23:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![fvancrae](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/f/ad7895/32.png) [@fvancrae](https://talk.remobjects.com/u/fvancrae)
#### Post date: [August 31, 2026, 3:23pm UTC](https://talk.remobjects.com/t/why-does-the-number-of-instances-of-a-pooled-service-drop-below-the-initial-pool-size/33895/1 "2026-08-31T15:23:07Z")

</div>

I am creating a pooled service with an initial pool size of 10 and an infite timeout.

I also preinitialize the pool.

I see that the 10 instances are created upon startup but when the service is used the instances get destroyed.

Shouldn’t it keep the 10 instances at all times?

 ![image](https://talk.remobjects.com/uploads/default/original/3X/f/8/f8fcf8cfe80d2e746a80369b5da4442eedbde090.png)

 ![image](https://talk.remobjects.com/uploads/default/original/3X/d/2/d2ac925654b94a8780db625d31832568d4047ff0.png)

… and after a while, we have 0 left

 ![image](https://talk.remobjects.com/uploads/default/original/3X/0/8/086ab462d94f61e6ff1f0555ca06b708067f2a45.png)

---

<div class="post-metadata">

### Author: ![fvancrae](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/f/ad7895/32.png) [@fvancrae](https://talk.remobjects.com/u/fvancrae)
#### Post date: [August 31, 2026, 3:25pm UTC](https://talk.remobjects.com/t/why-does-the-number-of-instances-of-a-pooled-service-drop-below-the-initial-pool-size/33895/2 "2026-08-31T15:25:04Z")

</div>

FYI: I allow additional services to be created. I assume the timeout will then determine if these additional services get freed at some point

---

<div class="post-metadata">

### Author: ![artem.vuitsyk](https://talk.remobjects.com/user_avatar/talk.remobjects.com/artem.vuitsyk/32/22063_2.png) [@artem.vuitsyk](https://talk.remobjects.com/u/artem.vuitsyk)
#### Post date: [September 1, 2026, 10:51am UTC](https://talk.remobjects.com/t/why-does-the-number-of-instances-of-a-pooled-service-drop-below-the-initial-pool-size/33895/4 "2026-09-01T10:51:59Z")

</div>

> [@fvancrae](#):
>
> Shouldn’t it keep the 10 instances at all times?

For remote calls, yes, they return the instance to the pool, and the value 10 remains.

For in-process calls, no. That is a bug on our side, it is fixed and will be in the next release.

In the meantime, return the instance to the class factory yourself instead of calling `Engine.ReleaseLocalService`:

```auto
// serviceName — the same name you pass to Engine.AcquireLocalService today
var factory = RemObjects.SDK.Server.Engine.ServiceManager.GetService(serviceName).ClassFactory;

var service = factory.AcquireInstance(sessionId); // activates it
try
{
    // your call on the service instance
}
finally
{
    factory.ReleaseInstance(sessionId, service); // deactivates and returns it to the pool
}

```

For `LocalDataAdapter`, acquire the instance the same way and assign it to the adapter’s `ServiceInstance` property an instance supplied from outside is not disposed by the adapter.

One thing to avoid until the fix: do not switch to `PoolBehavior.Wait` or `Fail`. The pool’s “in use” counter is leaked along with the instance, so `Fail` raises `ObjectPoolExhaustedException` and `Wait` blocks forever, even on an idle server.

The attached project runs both variants side by side against your installed Data Abstract open workaround and run.

[PoolWorkaround.zip](https://talk.remobjects.com/uploads/short-url/3NvAT8hRPAWk0TCPP0ajCxfwfes.zip) (2.1 KB)

---

<div class="post-metadata">

### Author: ![artem.vuitsyk](https://talk.remobjects.com/user_avatar/talk.remobjects.com/artem.vuitsyk/32/22063_2.png) [@artem.vuitsyk](https://talk.remobjects.com/u/artem.vuitsyk)
#### Post date: [September 2, 2026, 8:46am UTC](https://talk.remobjects.com/t/why-does-the-number-of-instances-of-a-pooled-service-drop-below-the-initial-pool-size/33895/5 "2026-09-02T08:46:36Z")

</div>

Fixed. Fix will be in the next release.
