Crashes on Windows 2003 Server

Oct 16, 2010 at 4:29 AM

Folks, I've got a mixture of WinForms, Console and ASP.NET apps that use Esent.Interop. They all develop in VS2010 Framework 4 and work perfectly on my Win7 development machine. When I run these apps on my Windows 2003 Server I get bizarre crashes like the following:

JET_errInvalidParameter in Api.JetTerm (in a WinForms app)
JET_errInstanceUnavailable in Api.JetEndSession (in an ASP.NET app)
JET_errBadLogVersion in Api.JetInit2 (creating an empty database in a Console app)

I'm unable to get dianostic information from other crashes because I just get the severe "Sorry for the inconvenience" dialog or a "w3wp.exe memory could not be read at 0x00000000" dialog. I've spent hours experimenting with different parameters and code combinations, but nothing makes any difference. Any attempt to use the Ensent API for even the simplest readonly call will crash myseriously. The HelloWorld collection sample does run correctlty.

This is a major blow to my rollout of some live apps that use ManagedEsent. Any clues would be greatly appreciated.

Greg

Oct 16, 2010 at 10:49 PM

After many hours of experiments I overcame my problems and I'd like to document them in case it helps others.

1. Do not create a database on one machine and deploy it to an OS of a different version. We should all know this, but I just forgot and followed my normal release procedure. This caused some (not all of my crashes). It's best if apps create a new database on demand. I had to code more infrastructure to allow this, but it's neater in the end.

2. Beware of feature differences on different machines. On Win7 I had Tagged NotNull columns, which are not allowed in Win 2003. JetCreateColumn was crashing.

3. I am getting different behaviour setting the TempDirectory property on the Instance class and using the Api.JetSetSystemParameter. I have not fully diagnosed this problem, but it seems that if I set the TempPath with the Api I get stalls and file not found errors. I'm pretty sure it's my fault due to passing path string without the trailing backslash, some experiments later today will confirm that. Actually, looking at the build 54759 source implies my Api calls are missing the backslashes, however, the symptoms if doing this are unpredictable. Low-level Apis are delicate and unforgiving.

4. Don't forget that esent tries to open any existing database files when you attach and open. Obvious, but I forgot, so my console utility which creates databases was attempting to read a more modern database before it could create the older one. I simply deleted the existing files and the create works.

So there are some traps to be wary of -- Cheers, Greg