bgelens/DSCPullServerAdmin

Get-DSCPullServerAdminStatusReport throws "Cannot open any more tables" error

Closed this issue · 6 comments

I know I mentioned this on Slack but I thought it would probably be best to raise it here instead.

I am using version 0.4.2 on a Server 2012 R2 pull server and have stopped IIS with iisreset /stop before making a copy of the Devices.edb file to a temporary location. Then against this copy of the DB I run the following commands and get the error as shown below.

Import-Module DSCPullServerAdmin
New-DSCPullServerAdminConnection -ESEFilePath '.\TempDevices.edb'
Get-DSCPullServerAdminStatusReport

Get-DSCPullServerESERecord : Cannot open any more tables (cleanup already attempted)
At line:2092 char:17
+                 Get-DSCPullServerESERecord @eseParams 
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OperationStopped: (:) [Write-Error], EsentTooManyOpenTablesException
+ FullyQualifiedErrorId : Microsoft.Isam.Esent.Interop.EsentTooManyOpenTablesException,Get-DSCPullServerESERecord 

Have you any idea why I am running into this?

As I mentioned today on Slack I had no issues when using the Copy-DSCPullServerAdminData command to create a fresh DB and import all my node registrations across. This temp DB is a copy of the fresh DB so there shouldn't be any old StatusReports hanging around only ones sent since this morning.

Cheers.

Did you copy all the other files to your temporary location as well? jfm, chk, log and jrs files should all be in the same directory before creating the connection

I have to admit only copied the .edb file. That seemed to work on its own for the registration data so I had assumed I didn't need the logs files etc. I will try again later with all files and let you know the outcome.

Unfortunately, I have just tried again and am getting the same error. This time, to rule out my copying of the database being an issue, I just ran iisreset /stop and then tried to run the Get-DSCPullServerAdminStatusReport command directly against the live DB i.e. C:\Program Files\WindowsPowerShell\DscService\Devices.edb. As I say, no change in the outcome unfortunately, still getting the error.

Ok. I'll need the files to check what is going on. Could you attach a zip or mail them to me at ben@bgelens.nl?

For reference when people are having the same / similar issue and find this one

The files that came in via mail where 2 sets of files combined (this is a guess but the errors indicated as such). From the original (full edb) and from the new one. This created another issue where esent api was unable to mount at all.

I managed to fix edb access by isolating devices.edb without any other files in the directory.
Next I ran New-DSCPullServerAdminConnection -ESEFilePath .\Devices.edb which throws an error but recreates new chk, jrs and other files.
Now I could run esentutl.exe /p .\Devices.edb to repair the edb
New-DSCPullServerAdminConnection will now succeed and registrations are accessible.

I was still not able to get all the reports out because of the too many tables open issue. After some manipulation of esent params I did not succeed to get any further and decided to just copy out the registrations into a new edb and stop troubleshooting.

I may have found a way to solve the issue by preloading the column definitions instead of doing it for each entry. I have opened pull request #59 for it.