none
ESENT JetCompact and Windows Server 2016 and Windows 10 Pro RRS feed

  • Question

  • This may not be the best forum, but it is the closest match I could find.

    We have an application that uses ESE as the back end database.  Some of our databases get quite large so we use the ESE JetCompact API function ( https://msdn.microsoft.com/en-us/library/gg269284(v=exchg.10).aspx ) to compact the databases.  Some of our clients have moved to Windows Server 2016 and Windows 10 Pro and the compact API function no longer works.

    We are seeing event logs like this.

    ourapp (3372) xxxxxxDB: An attempt to open the file "C:\xxxxxxxx\DB\xxxxxDB.jfm" for read / write access failed with system error 32 (0x00000020): "The process cannot access the file because it is being used by another process. ".  The open file operation will fail with error -1032 (0xfffffbf8).

    Now we are aware that the jfm file is new for windows 8 and above.

    This is the basic set of API calls we use leading to the JetCompact call

            JetSetSystemParameter( NULL, JET_sesidNil, JET_paramDatabasePageSize, ...
            JetSetSystemParameter( NULL, JET_sesidNil, JET_paramEnableFileCache, TRUE, NULL );
            JetSetSystemParameter( NULL, JET_sesidNil, JET_paramEnableViewCache, TRUE, NULL );
            JetCreateInstance( &m_jetInstance, ESENTDB_DATABASE_NAME );
            JetSetSystemParameter( &m_jetInstance, JET_sesidNil, JET_paramCacheSizeMax, gv_DatabaseCacheSize, NULL);
            JetSetSystemParameter( &m_jetInstance, JET_sesidNil, JET_paramMaxVerPages, gv_DatabaseMaximumVersionPages, NULL);
            JetSetSystemParameter( &m_jetInstance, JET_sesidNil, JET_paramCircularLog, FALSE, NULL );
            JetSetSystemParameter( &m_jetInstance, JET_sesidNil, JET_paramMaxOpenTables, (long)paramMaxOpenTables, NULL);
            JetSetSystemParameter( &m_jetInstance, JET_sesidNil, JET_paramMaxCursors, (long)(paramMaxCursors), NULL);
            JetSetSystemParameter( &m_jetInstance, JET_sesidNil, JET_paramAlternateDatabaseRecoveryPath, 0, gv_DatabasePath);
            JetSetSystemParameter( &m_jetInstance, JET_sesidNil, JET_paramLogFilePath, 0, gv_DatabasePath);
            JetSetSystemParameter( &m_jetInstance, JET_sesidNil, JET_paramSystemPath, 0, gv_DatabasePath);
            JetInit(&m_jetInstance);
            JetBeginSession(m_jetInstance, &m_jetSessionId, 0, 0 );
            JetAttachDatabase( m_jetSessionId, databaseFilename, 0 );

            JET_ERR err = JetCompact(m_jetSessionId, databaseFilename, compactFilename, (JET_PFNSTATUS)&EsentDb::pfnStatus, NULL, JET_bitCompactStats);

    After about 20 seconfs the pfnStatus callback is called with a JET_sntFail and the JetCompact returns with a -1032.

    Anyone have any ideas?

    Thanks

    Tuesday, October 17, 2017 11:02 PM

All replies

  • The error message is very clear; it says another process. Ensure that there is not another process accessing the file(s).


    Sam Hobbs
    SimpleSamples.Info

    Wednesday, October 18, 2017 4:47 AM
  • We have tried everything and there is no other process that we have been able to find.  This only occurs on W10 and we have a completely vanilla OS installation.

    ESENT under W10 has changed it now added a completely new file with the extension JFM to the mix.  The whole concept of using ESENT is it manages all of its file set that make up the database the calling application does nothing but call ESE.
    Wednesday, October 18, 2017 11:31 PM
  • I know that there is nothing built into Windows to determine what processes have a file opened but I know from past research that there are utilities, I just forgot what they are. They can be found by searching the internet, which is what I did to remind myself of the relevant utilities.

    A few years ago Microsoft bought SysInternals and have been offering the utilities they developed, one of which is Process Explorer. You can either download it from there but I suggest finding the option to download all the SysInternals utilities as a package. We can use Process Explorer to find the processes with a file open but how to do that is not so obvious. Go to "Find" | "Find Handle or DLL" and enter the filename or a portion.

    OpenedFilesView is another possibility.

    Also you can search the internet to get more information about JFM files. See Extensible Storage Engine Files. They are Flush Map Files and are new for Windows 10 Anniversary Update (client) and Windows Server 2016 (server).



    Sam Hobbs
    SimpleSamples.Info

    Thursday, October 19, 2017 12:38 AM
  • Yep, I was already aware that the JFM is new for W10.

    Using OpenFilesView indicates that the only files open in the directory are the .EDB and .JFM and they are both open by the application that is attempting to execute the Jet_Compact, as the application doesn't open any files directly I have to assume that these are opened by ESENT.

    My only though is that the Jet_Compact API is now broken by the new Flush Map Files.

    Means that we will need to get our client base to hold off on any updates beyond W7 and the server equivalent.

    Bugger.

    Thursday, October 19, 2017 3:38 AM
  • Another possibility is that the error message is wrong about it being another process. Perhaps it is the same process trying to open the file more than once and the sharing options don't allow it. That is only a guess.


    Sam Hobbs
    SimpleSamples.Info

    Thursday, October 19, 2017 4:16 AM