Symptoms

Upon startup, the CRX repository is working as expected. However, any content modification is not being indexed within Lucene. In the error log, the entries are recorded:

INFO [org.apache.jackrabbit.core.RepositoryImpl] (WorkspaceJanitor) disposing workspace 'myworkspace' which has been idle for 5064 ms
INFO [org.apache.jackrabbit.core.RepositoryImpl] (WorkspaceJanitor) shutting down workspace 'myworkspace'...
INFO [org.apache.jackrabbit.core.RepositoryImpl] (WorkspaceJanitor) workspace 'myworkspace' has been shutdown
ERROR [org.apache.jackrabbit.core.RepositoryImpl] (ajp-10.2.0.101-12152-20) Unable to initialize workspace 'myworkspace'

Cause

The following conditions must be met for the problem to exist:

  1. The repository is configured with a maxIdleTime
  2. The workspace in question is not the default workspace
  3. The index initialization takes more time than maxIdleTime
  4. The CRX version is 1.4.x

Non-default workspace is started when it is accessed the first time (first login to that workspace). The default workspace is started on repository startup time. Non-default workspace can get disposed (shut down) after a configurable idle time (i.e. meaning that only system/internal sessions are logged in to that workspace). The default value in CRX is 5 seconds.

Some components of a workspace are immediately initialized on workspace startup, while others are initialized on demand. The repository will set a flag on the workspace instance once the immediately initialized components are started. The background thread that checks whether a workspace can be disposed will check that flag and the time the workspace was last accessed. On startup, this can become a problem, because the index is initialized lazily. If the index startup will take more time than maxIdleTime, then the background checker thread will think that the workspace is idle and shut it down while the indexing is still starting up. This race condition has been fixed in CRX 2.0.

Resolution

This means the issue is fixed in CRX 2.0. The workaround for CRX 1.4.x is to either (1) to set maxIdleTime in repository.xml to 0 (NOTE: the default value in CRX 1.4.2 is 5 seconds) OR (2) to set defaultWorkspace in repository.xml to 'myworkspace' (NOTE: the default value in CRX 1.4.2 is 'crx.default').

The effect will be the same whether you do the first or the latter -- the myworkspace workspace will not be shutdown after some idle time.

There's one difference though -- only the default workspace is initialized immediately on repository startup, all others are only initialized on first access (first login to the workspace). This also means that an initial index or re-index is only triggered on first access for all non-default workspaces.

The index will need to be rebuild to correct for any non-indexed nodes while you were experiencing the problem. The officially supported and recommended way to fix the index is rebuilding it.

Applies to

CRX 1.4.x

Denna produkt är licensierad enligt en Creative Commons Erkännande-Ickekommersiell-Dela Lika 3.0 Unported-licens  Twitter™- och Facebook-inlägg omfattas inte av villkoren i Creative Commons-licensen.

Juridiska meddelanden   |   Onlinesekretesspolicy