Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store()/storeAll() causes "Storage is shut down." exception when garbage collection is involved #250

Closed
MutenRoshi84 opened this issue Sep 20, 2021 · 18 comments
Labels
bug Something isn't working
Milestone

Comments

@MutenRoshi84
Copy link

MutenRoshi84 commented Sep 20, 2021

Environment Details

  • MicroStream Version: 05.00.02-MS-GA

Describe the bug

Since I synchronize larger amounts of data at night, I activated the MicroStream GarbageCollector, carried out the GarbageCollection and deactivated the MicroStream GarbageCollector again.
After an indefinite period of time, the already known problem with store () / storeAll () and the exception "Storage is shut down" occurs. This also occurs after restarting the application and without a shutdown of the storage that I initiated or intended. No exceptions were shown to me while starting the storage. Reading the db is still partially possible.

I noticed that if this exception occurred when saving to the storage and then the application is started without the following garbage collection, then the storage can be used again without problems, i.e. store () / storeAll () is also possible again.

StorageEntityCache.Default.setGarbageCollectionEnabled (true);
STORAGE.issueFullGarbageCollection ();
StorageEntityCache.Default.setGarbageCollectionEnabled (false);

However, if the GarbageCollection is activated again the next time it is started, the store () / storeAll () problem occurs again.

Are there possibilities / methods to better document the start, the behavior or the state of the storage or the GC, or to receive specific outputs? Could you give me some code examples in this regard?
I might be able to provide further / helpful information to solve this issue. It would also be possible for me to create a ThreadDump in the db after the unsuccessful write attempt, shortly after the db started.

I've attached the exceptions and the code for starting and shutting down.

Output Console/Log (Update of the user via store (...)):

one.microstream.persistence.exceptions.PersistenceExceptionTransfer
   at one.microstream.storage.embedded.types.EmbeddedStorageBinaryTarget$Default.write(EmbeddedStorageBinaryTarget.java:90)
   at one.microstream.storage.embedded.types.EmbeddedStorageBinaryTarget$Default.write(EmbeddedStorageBinaryTarget.java:1)
   at one.microstream.persistence.binary.types.BinaryStorer$Default.commit(BinaryStorer.java:501)
   at one.microstream.persistence.types.PersistenceManager$Default.store(PersistenceManager.java:298)
   at one.microstream.storage.types.StorageConnection.store(StorageConnection.java:367)
   at de.ui.beans.RegisterOrLogin.login(RegisterOrLogin.java:162)
   at de.ui.beans.RegisterOrLogin.txtLoginPassword_onKeyDown(RegisterOrLogin.java:298)
   at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:205)
   at com.vaadin.flow.component.ComponentEventBus.handleDomEvent(ComponentEventBus.java:373)
   at com.vaadin.flow.component.ComponentEventBus.lambda$addDomTrigger$dd1b7957$1(ComponentEventBus.java:264)
   at com.vaadin.flow.internal.nodefeature.ElementListenerMap.lambda$fireEvent$2(ElementListenerMap.java:441)
   at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
   at com.vaadin.flow.internal.nodefeature.ElementListenerMap.fireEvent(ElementListenerMap.java:441)
   at com.vaadin.flow.server.communication.rpc.EventRpcHandler.handleNode(EventRpcHandler.java:59)
   at com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler.handle(AbstractRpcInvocationHandler.java:64)
   at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocationData(ServerRpcHandler.java:409)
   at com.vaadin.flow.server.communication.ServerRpcHandler.lambda$handleInvocations$1(ServerRpcHandler.java:390)
   at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
   at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:390)
   at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:317)
   at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:89)
   at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
   at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1547)
   at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:247)
   at com.rapidclipse.framework.server.RapServlet.service(RapServlet.java:159)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723)
   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: one.microstream.storage.exceptions.StorageExceptionNotRunning: Storage is shut down.
   at one.microstream.storage.types.StorageTaskBroker$Default.enqueueTask(StorageTaskBroker.java:212)
   at one.microstream.storage.types.StorageTaskBroker$Default.enqueueTask(StorageTaskBroker.java:197)
   at one.microstream.storage.types.StorageTaskBroker$Default.enqueueTaskAndNotifyAll(StorageTaskBroker.java:187)
   at one.microstream.storage.types.StorageTaskBroker$Default.enqueueStoreTask(StorageTaskBroker.java:396)
   at one.microstream.storage.types.StorageRequestAcceptor$Default.storeData(StorageRequestAcceptor.java:177)
   at one.microstream.storage.embedded.types.EmbeddedStorageBinaryTarget$Default.write(EmbeddedStorageBinaryTarget.java:86)
   ... 47 more
Output Console/Log (Update of the user via storeAll (...)):

one.microstream.persistence.exceptions.PersistenceExceptionTransfer
   at one.microstream.storage.embedded.types.EmbeddedStorageBinaryTarget$Default.write(EmbeddedStorageBinaryTarget.java:90)
   at one.microstream.storage.embedded.types.EmbeddedStorageBinaryTarget$Default.write(EmbeddedStorageBinaryTarget.java:1)
   at one.microstream.persistence.binary.types.BinaryStorer$Default.commit(BinaryStorer.java:501)
   at one.microstream.persistence.types.PersistenceManager$Default.storeAll(PersistenceManager.java:316)
   at one.microstream.storage.types.StorageConnection.storeAll(StorageConnection.java:376)
   at de.dao.UserDAO.update(UserDAO.java:131)
   at de.ui.beans.CartDialog.lambda$setContent$0(CartDialog.java:113)
   at de.ui.bits.CartProductBox.btnRemove_onClick(CartProductBox.java:267)
   at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:205)
   at com.vaadin.flow.component.ComponentEventBus.handleDomEvent(ComponentEventBus.java:373)
   at com.vaadin.flow.component.ComponentEventBus.lambda$addDomTrigger$dd1b7957$1(ComponentEventBus.java:264)
   at com.vaadin.flow.internal.nodefeature.ElementListenerMap.lambda$fireEvent$2(ElementListenerMap.java:441)
   at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
   at com.vaadin.flow.internal.nodefeature.ElementListenerMap.fireEvent(ElementListenerMap.java:441)
   at com.vaadin.flow.server.communication.rpc.EventRpcHandler.handleNode(EventRpcHandler.java:59)
   at com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler.handle(AbstractRpcInvocationHandler.java:64)
   at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocationData(ServerRpcHandler.java:409)
   at com.vaadin.flow.server.communication.ServerRpcHandler.lambda$handleInvocations$1(ServerRpcHandler.java:390)
   at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
   at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:390)
   at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:317)
   at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:89)
   at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
   at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1547)
   at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:247)
   at com.rapidclipse.framework.server.RapServlet.service(RapServlet.java:159)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723)
   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: one.microstream.storage.exceptions.StorageExceptionNotRunning: Storage is shut down.
   at one.microstream.storage.types.StorageTaskBroker$Default.enqueueTask(StorageTaskBroker.java:212)
   at one.microstream.storage.types.StorageTaskBroker$Default.enqueueTask(StorageTaskBroker.java:197)
   at one.microstream.storage.types.StorageTaskBroker$Default.enqueueTaskAndNotifyAll(StorageTaskBroker.java:187)
   at one.microstream.storage.types.StorageTaskBroker$Default.enqueueStoreTask(StorageTaskBroker.java:396)
   at one.microstream.storage.types.StorageRequestAcceptor$Default.storeData(StorageRequestAcceptor.java:177)
   at one.microstream.storage.embedded.types.EmbeddedStorageBinaryTarget$Default.write(EmbeddedStorageBinaryTarget.java:86)
   ... 48 more
Database.java

public class Database {
    private static Logger logger = LoggerFactory.getLogger(Database.class);

	public static final Reference<Root> ROOT = X.Reference(new Root());
	public static final EmbeddedStorageManager STORAGE;
	private static final Path PATH;

	static {
		PATH = Paths.get(System.getProperty("user.home"), "MicroStream", "Shop");

		try {
			if (!PATH.toFile().exists()) {
				Files.createDirectory(Database.PATH);
				logger.info("MS-DB: No existing path to DB-files found. Path was created.");
			} else {
				logger.info("MS-DB: Already existing path to DB-files found.");		
			}
		} catch (final IOException e) {
			e.printStackTrace();
		}

        STORAGE = EmbeddedStorage.start(Database.ROOT, Database.PATH);
        StorageEntityCache.Default.setGarbageCollectionEnabled(true);
        storage.issueFullGarbageCollection();

        // As a precaution, the GC is deactivated again so that there is no risk of the shop being shut down during garbage collection, which could result in inconsistencies in the DB.
		StorageEntityCache.Default.setGarbageCollectionEnabled(false);
    }
}
MicroStreamContextDestroyer.java

@WebListener
public class MicroStreamContextDestroyer implements ServletContextListener {
	private static Logger logger = LoggerFactory.getLogger(MicroStreamContextDestroyer.class);

	@Override
	public void contextInitialized(final ServletContextEvent sce) {
	}

	@Override
	public void contextDestroyed(final ServletContextEvent sce) {
		logger.info("MicroStreamContextDestroyer: Destruction of context started.");
		
		logger.info("MS-DB STORAGE Shutdown: Check MS-DB STORAGE for shutdown.");
		if (Database.STORAGE != null) {
			if (Database.STORAGE.shutdown()) {
				logger.info("MS-DB STORAGE Shutdown: All active threads that manage the MicroStream memory have been shut down successfully.");
			} else {
				logger.error("MS-DB STORAGE Shutdown: An internal InterruptedException occurred during the shutdown of all active threads that manage the MicroStream memory.");
			}
		} else {
			logger.info("MS-DB Shutdown: No started MS-DB found to shut down.");
		}
		
		// Stop the LazyReference Manager to prevent memory leaks.
		LazyReferenceManager lazyReferenceManager = LazyReferenceManager.get();
		if (lazyReferenceManager != null) {
			lazyReferenceManager.stop();
			logger.info("MS-DB LazyReferenceManager Shutdown: LazyReferenceManager triggered to stop.");
		} else {
			logger.error("MS-DB LazyReferenceManager Shutdown: No LazyReferenceManager found to stop.");
		}
		logger.info("MicroStreamContextDestroyer: Destruction of context finished.");
	}
}

Additional context

  • This issue has existed since version 04.01.00-MS-GA.
  • No lazy references are used.
@hg-ms
Copy link
Contributor

hg-ms commented Sep 22, 2021

Hello,
The “Storage is shutdown” Exceptions usually gets thrown when you try to access the storage after a #shutdown() has been initiated. This can be done by your code or from the storage itself in case of internal errors.

The Logs above don’t show any cause why the storage has been shut down.
Are there any other logs from the Server available that may have logged such an exception?
Normally the storage should not throw an exception if it triggers an shutdown because of internal errors.

The first idea to narrow down the problem would be to log/check the startup of the storage.
In your Database class this is line “STORAGE = EmbeddedStorage.start(Database.ROOT, Database.PATH);” Maybe you can put it into a try-catch block and log all exceptions.
The start() should not throw any exceptions.

@MutenRoshi84
Copy link
Author

Are there any other logs from the Server available that may have logged such an exception?

No, that was/is the only available log.

Normally the storage should not throw an exception if it triggers an shutdown because of internal errors.

Is there a reason why there is no information about this in the console/logs? Would be very informative to know.

In your Database class this is line “STORAGE = EmbeddedStorage.start(Database.ROOT, Database.PATH);” Maybe you can put it into a try-catch block and log all exceptions.

I did it in the try / catch block, but as you pointed out, no exception occurred on startup.

Please note that the problem with the storage only occurs in connection with the GC. If this is deactivated, the storage can be used normally again.

I noticed that the LazyReferenceManager cannot always be stopped when shutting down the Tomcat. The stopping is carried out in the class MicroStreamContextDestroyer (lazyReferenceManager.stop()).

24.09 00:20:00 [http-nio-8080-exec-71] INFO  [de.db.MicroStreamContextDestroyer]  MicroStreamContextDestroyer: Destruction of context started.
24.09 00:20:00 [http-nio-8080-exec-71] INFO  [de.db.MicroStreamContextDestroyer]  MS-DB STORAGE Shutdown: Check MS-DB STORAGE for shutdown.
24.09 00:20:01 [http-nio-8080-exec-71] INFO  [de.db.MicroStreamContextDestroyer]  MS-DB STORAGE Shutdown: All active threads that manage the MicroStream memory have been shut down successfully.
24.09 00:20:01 [http-nio-8080-exec-71] INFO  [de.db.MicroStreamContextDestroyer]  MS-DB LazyReferenceManager Shutdown: LazyReferenceManager triggered to stop.
24.09 00:20:01 [http-nio-8080-exec-71] INFO  [de.db.MicroStreamContextDestroyer]  MicroStreamContextDestroyer: Destruction of context finished.
24.09 00:20:01 [http-nio-8080-exec-71] INFO  [org.quartz.core.QuartzScheduler]  Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down.
24.09 00:20:01 [http-nio-8080-exec-71] INFO  [org.quartz.core.QuartzScheduler]  Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused.
24.09 00:20:01 [http-nio-8080-exec-71] INFO  [org.quartz.core.QuartzScheduler]  Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete.
24-Sep-2021 00:20:01.737 WARNUNG [http-nio-8080-exec-71] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [shop] appears to have started a thread named [LazyReferenceManager
@153828390] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.base@11.0.12/java.lang.Thread.sleep(Native Method)
 one.microstream.reference.LazyReferenceManager$Default$LazyReferenceCleanupThread.run(LazyReferenceManager.java:667)

Can the starting / use of the LazyReferenceManager be deactivated if no LazyReferences are used to circumvent such cases? I don't use lazy references in the DB.

Could the incorrect shutdown of the LazyReferenceManager possibly trigger the problems with the GC?

@hg-ms
Copy link
Contributor

hg-ms commented Sep 29, 2021

Is there a reason why there is no information about this in the console/logs? Would be very informative to know.

I made an bad typing error in my last post I have to apologize for:

I wrote
“Normally the storage should not throw a exception if it triggers a shutdown because of internal errors.”

But it should be
“Normally the storage should throw a exception if it triggers a shutdown because of internal errors.”

@hg-ms
Copy link
Contributor

hg-ms commented Sep 29, 2021

Could the incorrect shutdown of the LazyReferenceManager possibly trigger the problems with the GC?

You can’t prevent the LazyReferenceManager from starting but it’s ok to stop it immediately after starting the storage:

final EmbeddedStorageManager storageManager = EmbeddedStorage.start();
LazyReferenceManager.get().stop();

If the LazyReferenceManager is stopped Lazy-References won’t be cleaned automatically but this should be no problem if you don’t use them.

The LazyReferenceManager’s related shutdown issue should not have an impact on the GC. LazyReferenceManager.get().stop() just does not wait for the task to be closed.

@MutenRoshi84
Copy link
Author

MutenRoshi84 commented Oct 1, 2021

"You can’t prevent the LazyReferenceManager from starting but it’s ok to stop it immediately after starting the storage:"

Thanks for the hint.

“The first idea to narrow down the problem would be to log/check the startup of the storage.”

Do you have any other suggestions what I can do?

“Normally the storage should throw a exception if it triggers a shutdown because of internal errors.”

Where can / should I catch this exception?

For logging I'm using Log4j in combination with SLF4J. I adjusted my Log4j config and set the log level from "Debug" to "Trace".

log4j.rootLogger=TRACE, file, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{dd.MM HH:mm:ss} [%t] %-5p [%c] %X{FULL_LOCATION_INFO} %m%n

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=${user.home}/shop.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.LocationInfo=true
log4j.appender.file.Append=true
log4j.appender.file.MaxFileSize=150MB
log4j.appender.file.MaxBackupIndex=20
log4j.appender.file.layout.ConversionPattern=%d{dd.MM HH:mm:ss} [%t] %-5p [%c] %X{FULL_LOCATION_INFO} %m%n

Are further settings advisable to get better logging of the db? Sorry, I am not so familiar with logging.
In addition, I have now also packed the section with the GC in a try / catch block to catch any exceptions.

Thanks for your help!

@hg-ms
Copy link
Contributor

hg-ms commented Oct 1, 2021

Where can / should I catch this exception?

Nearly every Microstream call can throw exceptions. Especially the “store” calls may be interesting.

Are further settings advisable to get better logging of the db?

Microstream itself has no logging that could be enabled.

Do you have any other suggestions what I can do?

As you don’t have any other logs I run out of ideas. I would have expected your webserver to log any uncatched exception.
Did you check your code if there are catch clauses that swallow excptions?

@MutenRoshi84
Copy link
Author

Nearly every Microstream call can throw exceptions. Especially the “store” calls may be interesting.

The problem doesn't seem to be primarily with the store () / storeAll () methods, but with GarbageCollection.
See my description at the beginning (source code and "GC on / off"). It seems like the GC has an internal error causing the storage to shut down.

In this regard, I have again made outputs that show the status of the storage. Please pay attention to the status "isShutdown".

Garbage collection is not activated in the first log file. Storage tests containing store () / storeAll () are also performed. There are no problems with the storage.

Log-File: GC not activated

05.10 10:38:41 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  MS-DB: Already existing path to DB-files found.
05.10 10:38:41 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  MS-DB: File 'PersistenceTypeDictionary.ptd' was found.
05.10 10:38:41 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  MS-DB: File 'refactorings.csv' was found.
05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  Storage started without errors.

05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (after start-STORAGE-Section): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  StorageStoreTest (after start-STORAGE-Section): attributeForDbTest will be set to 'true' and stored.
05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (between StorageTests attributeForDbTest and User): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  StorageStoreTest - User (after start-STORAGE-Section): lastLoginDate will be set to '2021-10-05T10:39:01.089594300' and stored.
05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (after StorageStoreTest (start-STORAGE-Section)): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  MS-DB LazyReferenceManager Shutdown: LazyReferenceManager triggered to stop.

05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (before GC-Section): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

!!! Garbage Collection is not activated !!!

05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (after GC-Section): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  StorageStoreTest (after GC-Section): attributeForDbTest will be set to 'false' and stored.
05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (between StorageTests attributeForDbTest and User): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  StorageStoreTest - User (after GC-Section): lastLoginDate will be set to '2021-10-05T10:39:01.590255300' and stored.

05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (after StorageStoreTest (GC-Section)): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-3] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-2] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-9] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-8] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-4] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-10] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-5] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-6] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-7] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:01 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

...

05.10 10:39:06 [DefaultQuartzScheduler_Worker-6] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:39:06 [http-nio-8081-exec-3] DEBUG [de.db.DatabaseUtils]  logStorageStates (manually over Debug - before StorageStoreTests): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:06 [http-nio-8081-exec-3] DEBUG [de.db.DatabaseUtils]  StorageStoreTest (manually over Debug): attributeForDbTest will be set to 'true' and stored.
05.10 10:39:06 [http-nio-8081-exec-3] DEBUG [de.db.DatabaseUtils]  logStorageStates (between StorageTests attributeForDbTest and User): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:06 [http-nio-8081-exec-3] DEBUG [de.db.DatabaseUtils]  StorageStoreTest - User (manually over Debug): lastLoginDate will be set to '2021-10-05T10:39:06.554562500' and stored.
05.10 10:39:06 [http-nio-8081-exec-3] DEBUG [de.db.DatabaseUtils]  logStorageStates (manually over Debug - after StorageStoreTests): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:39:07 [DefaultQuartzScheduler_Worker-5] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:08 [DefaultQuartzScheduler_Worker-10] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:39:08 [http-nio-8081-exec-7] DEBUG [de.db.DatabaseUtils]  logStorageStates (manually over Debug - before StorageStoreTests): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:08 [http-nio-8081-exec-7] DEBUG [de.db.DatabaseUtils]  StorageStoreTest (manually over Debug): attributeForDbTest will be set to 'false' and stored.
05.10 10:39:08 [http-nio-8081-exec-7] DEBUG [de.db.DatabaseUtils]  logStorageStates (between StorageTests attributeForDbTest and User): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:08 [http-nio-8081-exec-7] DEBUG [de.db.DatabaseUtils]  StorageStoreTest - User (manually over Debug): lastLoginDate will be set to '2021-10-05T10:39:08.706398' and stored.
05.10 10:39:08 [http-nio-8081-exec-7] DEBUG [de.db.DatabaseUtils]  logStorageStates (manually over Debug - after StorageStoreTests): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:39:09 [DefaultQuartzScheduler_Worker-4] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:39:49 [DefaultQuartzScheduler_Worker-4] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:49 [http-nio-8081-exec-4] DEBUG [de.db.DatabaseUtils]  logStorageStates (manually over Debug - before StorageStoreTests): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:49 [http-nio-8081-exec-4] DEBUG [de.db.DatabaseUtils]  StorageStoreTest (manually over Debug): attributeForDbTest will be set to 'true' and stored.
05.10 10:39:49 [http-nio-8081-exec-4] DEBUG [de.db.DatabaseUtils]  logStorageStates (between StorageTests attributeForDbTest and User): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:39:49 [http-nio-8081-exec-4] DEBUG [de.db.DatabaseUtils]  StorageStoreTest - User (manually over Debug): lastLoginDate will be set to '2021-10-05T10:39:49.953785500' and stored.
05.10 10:39:49 [http-nio-8081-exec-4] DEBUG [de.db.DatabaseUtils]  logStorageStates (manually over Debug - after StorageStoreTests): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

Garbage collection is activated in the second log file (see source code of the problem description at the beginning). It can be observed that the storage starts without errors. Shortly thereafter, the garbage collection is started and 2 seconds later the storage is shut down. No StorageStoreTests (with store () / storeAll ()) were performed. The activation, execution and deactivation of the GarbageCollection was packed in a try / catch block to catch any exceptions. But no exceptions occurred.

Log-File: GC activated

05.10 10:58:02 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  MS-DB: Already existing path to DB-files found.
05.10 10:58:02 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  MS-DB: File 'PersistenceTypeDictionary.ptd' was found.
05.10 10:58:02 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  MS-DB: File 'refactorings.csv' was found.
05.10 10:58:20 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  Storage started without errors.

05.10 10:58:20 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (after start-STORAGE-Section): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:20 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  MS-DB LazyReferenceManager Shutdown: LazyReferenceManager triggered to stop.

05.10 10:58:21 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (before GC-Section): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

!!! Activating Garbage Collection !!!
05.10 10:58:21 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  GC: StorageEntityCache.Default.setGarbageCollectionEnabled(true)
05.10 10:58:23 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  STORAGE.issueFullGarbageCollection()
05.10 10:58:23 [DefaultQuartzScheduler_Worker-1] INFO  [de.db.Database]  GC: StorageEntityCache.Default.setGarbageCollectionEnabled(false)

05.10 10:58:23 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (after GC-Section): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:58:23 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:58:23 [DefaultQuartzScheduler_Worker-6] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:58:23 [DefaultQuartzScheduler_Worker-10] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:58:23 [DefaultQuartzScheduler_Worker-3] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:58:23 [DefaultQuartzScheduler_Worker-7] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:58:23 [DefaultQuartzScheduler_Worker-2] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:58:23 [DefaultQuartzScheduler_Worker-9] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:58:23 [DefaultQuartzScheduler_Worker-4] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:58:23 [DefaultQuartzScheduler_Worker-8] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false
05.10 10:58:23 [DefaultQuartzScheduler_Worker-5] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-3] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-6] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-10] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-9] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-4] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-2] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-7] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-8] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-5] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-1] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:23 [DefaultQuartzScheduler_Worker-3] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:24 [DefaultQuartzScheduler_Worker-6] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> true || isActive() -> true || isStartingUp() -> false || isRunning() -> true || isShuttingDown() -> false || isShutdown() -> false

05.10 10:58:25 [DefaultQuartzScheduler_Worker-10] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> false || isActive() -> true || isStartingUp() -> false || isRunning() -> false || isShuttingDown() -> false || isShutdown() -> true

05.10 10:58:26 [DefaultQuartzScheduler_Worker-9] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> false || isActive() -> true || isStartingUp() -> false || isRunning() -> false || isShuttingDown() -> false || isShutdown() -> true

05.10 10:58:27 [DefaultQuartzScheduler_Worker-4] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> false || isActive() -> true || isStartingUp() -> false || isRunning() -> false || isShuttingDown() -> false || isShutdown() -> true

05.10 10:58:28 [DefaultQuartzScheduler_Worker-2] DEBUG [de.db.DatabaseUtils]  logStorageStates (StorageStatiSpammer-Job): isAcceptingTasks -> false || isActive() -> true || isStartingUp() -> false || isRunning() -> false || isShuttingDown() -> false || isShutdown() -> true

Have you already made such observations? Have you been able to reproduce the behavior? How do you rate this behavior? Have you already received this feedback from others or am I alone?

Could the error be caused by some data type that the GC cannot handle? Or maybe the problem from the ticket #240 has something to do with this problem?


Microstream itself has no logging that could be enabled.

Why is/was no logging implemented? Does this have any particular reason? That would be very helpful for debugging.


As you don’t have any other logs I run out of ideas. I would have expected your webserver to log any uncatched exception.
Did you check your code if there are catch clauses that swallow excptions?

Ich habe meinen Code gecheckt, im Code sind keine schluckenden Catch Clauses. Mit dem Logging des Webservers muss ich mich noch beschäftigen.

I checked my code, there are no catch clauses in the code which are swallowing exceptions. I still have to deal with the logging of the web server.

@hg-ms
Copy link
Contributor

hg-ms commented Oct 6, 2021

Many thanks for the detailed logging of the storage’s state. With that and the previous logs you already provided I must admit that this is a new Bug we did not observe until now.

Have you already made such observations?

An issue that causes the storage to shut down without an exception in interaction with the GC is new. With simpler scenarios we where not able to reproduce this until now. But we still try to do so.

Or maybe the problem from the ticket #240 has something to do with this problem?

I doubt that this is related to issue #240. Issue #240 resulted in 2 threads blocking each other but not in a storage shutdown. If such blocked thread is detected and killed by your webserver, I would expect some kind of log entry related to in the server logs.

Could the error be caused by some data type that the GC cannot handle?

If there are types not handleable there should be an exception the first time the type gets persisted, but this is not related to the GC.

logging

There is one additional option the add more logging. You could add a custom implementation of the one.microstream.storage.types.StorageEventLogger. (Maybe the StorageEventLogger.Default implementation may be sufficient too). With that you can log a few internals of the storage channels behaviors.
To set it up just register an instance of that:

EmbeddedStorageManager storage = EmbeddedStorage.Foundation()
    .setEventLogger(new MyStorageEventLogger())
    .start();

One other option might be to shut down the storage after the manual GC run and start it again without the GC enabled.

@hg-ms hg-ms added the bug Something isn't working label Oct 6, 2021
@MutenRoshi84
Copy link
Author

One other option might be to shut down the storage after the manual GC run and start it again without the GC enabled.

My approach is to start the GC manually at a much later point in time. Because apparently the crux of the matter is that the problem occurs when the GC is executed directly at the start of the application and the DB. If the GC runs later then the problem does not seem to occur.


I tried to start the storage again after it was shut down when the GC started and got the following output. This may help you further:

STORAGE.start():


one.microstream.storage.exceptions.StorageException: Problem in channel 0
   at one.microstream.storage.types.StorageChannelTask$Abstract.checkForProblems(StorageChannelTask.java:84)
   at one.microstream.storage.types.StorageChannelTask$Abstract.waitOnCompletion(StorageChannelTask.java:146)
   at one.microstream.storage.types.StorageSystem$Default.startThreads(StorageSystem.java:315)
   at one.microstream.storage.types.StorageSystem$Default.internalStartUp(StorageSystem.java:493)
   at one.microstream.storage.types.StorageSystem$Default.start(StorageSystem.java:573)
   at one.microstream.storage.types.StorageSystem$Default.start(StorageSystem.java:1)
   at one.microstream.storage.embedded.types.EmbeddedStorageManager$Default.start(EmbeddedStorageManager.java:243)
   at one.microstream.storage.embedded.types.EmbeddedStorageManager$Default.start(EmbeddedStorageManager.java:1)
   at de.ui.views.Debug.btnStartStorage_onClick(Debug.java:2085)
   at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:205)
   at com.vaadin.flow.component.ComponentEventBus.handleDomEvent(ComponentEventBus.java:373)
   at com.vaadin.flow.component.ComponentEventBus.lambda$addDomTrigger$dd1b7957$1(ComponentEventBus.java:264)
   at com.vaadin.flow.internal.nodefeature.ElementListenerMap.lambda$fireEvent$2(ElementListenerMap.java:441)
   at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
   at com.vaadin.flow.internal.nodefeature.ElementListenerMap.fireEvent(ElementListenerMap.java:441)
   at com.vaadin.flow.server.communication.rpc.EventRpcHandler.handleNode(EventRpcHandler.java:59)
   at com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler.handle(AbstractRpcInvocationHandler.java:64)
   at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocationData(ServerRpcHandler.java:409)
   at com.vaadin.flow.server.communication.ServerRpcHandler.lambda$handleInvocations$1(ServerRpcHandler.java:390)
   at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
   at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:390)
   at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:317)
   at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:89)
   at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
   at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1547)
   at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:247)
   at com.rapidclipse.framework.server.RapServlet.service(RapServlet.java:159)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726)
   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
   at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: one.microstream.afs.exceptions.AfsExceptionExclusiveAttemptConflict: File is already used by a different exclusive user: one.microstream.afs.types.AFile$Default@40f67ffd("/root/MicroStream/Shop/channel
_0/transactions_0.sft"). Exclusive user: (java.lang.Thread@e5b8278) Thread[MicroStream-StorageChannel-0,5,]. Attempting user: (java.lang.Thread@79807508) Thread[MicroStream-StorageChannel-0,5,main].
   at one.microstream.afs.types.AccessManager$Default$2.handleExclusiveAttemptConflict(AccessManager.java:732)
   at one.microstream.afs.types.AccessManager$Default.internalUseWriting(AccessManager.java:641)
   at one.microstream.afs.types.AccessManager$Default.useWriting(AccessManager.java:482)
   at one.microstream.afs.types.AFile.useWriting(AFile.java:108)
   at one.microstream.afs.types.AFS.applyWriting(AFS.java:272)
   at one.microstream.afs.types.AFS.applyWriting(AFS.java:262)
   at one.microstream.afs.types.AFile.ensureExists(AFile.java:157)
   at one.microstream.storage.types.StorageFileManager$Default.createTransactionsFile(StorageFileManager.java:1106)
   at one.microstream.storage.types.StorageFileManager$Default.readTransactionsFile(StorageFileManager.java:716)
   at one.microstream.storage.types.StorageFileManager$Default.readStorage(StorageFileManager.java:701)
   at one.microstream.storage.types.StorageChannel$Default.readStorage(StorageChannel.java:731)
   at one.microstream.storage.types.StorageChannelTaskInitialize$Default.internalProcessBy(StorageChannelTaskInitialize.java:195)
   at one.microstream.storage.types.StorageChannelTaskInitialize$Default.internalProcessBy(StorageChannelTaskInitialize.java:1)
   at one.microstream.storage.types.StorageChannelTask$Abstract.processBy(StorageChannelTask.java:220)
   at one.microstream.storage.types.StorageChannel$Default.work(StorageChannel.java:408)
   at one.microstream.storage.types.StorageChannel$Default.run(StorageChannel.java:495)
   ... 1 more

Furthermore, I was able to observe that when the GC is started at the start of the application and the DB, the storage is shut down after processing a file (default: 8MB).

@hg-ms
Copy link
Contributor

hg-ms commented Oct 12, 2021

Many thanks for the additional log.
In the meanwhile, we were able to create a scenario that reproduces your initial problem (storage is shut down after gc).

@MutenRoshi84
Copy link
Author

Many thanks for the additional log.
In the meanwhile, we were able to create a scenario that reproduces your initial problem (storage is shut down after gc).

You are welcome.
This is great news!

@MutenRoshi84
Copy link
Author

(Maybe the StorageEventLogger.Default implementation may be sufficient too)

I think that was a typo and you must mean StorageEventLogger.Debug().

I implemented it and got the following output, which you have probably already seen in connection with the "StorageIsShutdown" exception:

12.10 14:17:32 [http-nio-8081-exec-1] INFO  [de.ui.views.Debug]  Starting manually MS-DB-Housekeeping-FullGarbageCollection...
12.10 14:17:32 [http-nio-8081-exec-1] INFO  [de.ui.views.Debug]  GC: StorageEntityCache.Default.setGarbageCollectionEnabled(true)
.sweep(StorageEntityCache.java:1016)                            14:17:33.520> StorageChannel#0 completed sweeping.
.completeSweep(StorageEntityMarkMonitor.java:536)               14:17:33.521> Completed GC Hot Phase #1 @ 1634041053521
.sweep(StorageEntityCache.java:1016)                            14:17:36.360> StorageChannel#0 completed sweeping.
.completeSweep(StorageEntityMarkMonitor.java:536)               14:17:36.361> Storage-GC completed #1 @ 1634041056360
12.10 14:17:36 [http-nio-8081-exec-1] INFO  [de.ui.views.Debug]  GC: STORAGE.issueFullGarbageCollection()
12.10 14:17:36 [http-nio-8081-exec-1] INFO  [de.ui.views.Debug]  GC: StorageEntityCache.Default.setGarbageCollectionEnabled(false)
.run(StorageChannel.java:495)                                   14:17:37.380> StorageChannel#0 encountered exception java.lang.NullPointerException: Cannot read field "file" because "<parameter1>" is null
.run(StorageChannel.java:495)                                   14:17:37.380> StorageChannel#0 processing disabled.
.run(StorageChannel.java:495)                                   14:17:37.380> StorageChannel#0 stopped working.

@MutenRoshi84
Copy link
Author

MutenRoshi84 commented Oct 13, 2021

My approach is to start the GC manually at a much later point in time. Because apparently the crux of the matter is that the problem occurs when the GC is executed directly at the start of the application and the DB. If the GC runs later then the problem does not seem to occur.

I have to correct myself. This exception "StorageIsShutdown" also occurs if the GC is started manually later and not only to start the application / database.


Is this a bug that is a high priority for you and you are currently working on a solution?

@hg-ms
Copy link
Contributor

hg-ms commented Oct 13, 2021

(Maybe the StorageEventLogger.Default implementation may be sufficient too)

I think that was a typo and you must mean StorageEventLogger.Debug().

I implemented it and got the following output, which you have probably already seen in connection with the "StorageIsShutdown" exception:

12.10 14:17:32 [http-nio-8081-exec-1] INFO  [de.ui.views.Debug]  Starting manually MS-DB-Housekeeping-FullGarbageCollection...
12.10 14:17:32 [http-nio-8081-exec-1] INFO  [de.ui.views.Debug]  GC: StorageEntityCache.Default.setGarbageCollectionEnabled(true)
.sweep(StorageEntityCache.java:1016)                            14:17:33.520> StorageChannel#0 completed sweeping.
.completeSweep(StorageEntityMarkMonitor.java:536)               14:17:33.521> Completed GC Hot Phase #1 @ 1634041053521
.sweep(StorageEntityCache.java:1016)                            14:17:36.360> StorageChannel#0 completed sweeping.
.completeSweep(StorageEntityMarkMonitor.java:536)               14:17:36.361> Storage-GC completed #1 @ 1634041056360
12.10 14:17:36 [http-nio-8081-exec-1] INFO  [de.ui.views.Debug]  GC: STORAGE.issueFullGarbageCollection()
12.10 14:17:36 [http-nio-8081-exec-1] INFO  [de.ui.views.Debug]  GC: StorageEntityCache.Default.setGarbageCollectionEnabled(false)
.run(StorageChannel.java:495)                                   14:17:37.380> StorageChannel#0 encountered exception java.lang.NullPointerException: Cannot read field "file" because "<parameter1>" is null
.run(StorageChannel.java:495)                                   14:17:37.380> StorageChannel#0 processing disabled.
.run(StorageChannel.java:495)                                   14:17:37.380> StorageChannel#0 stopped working.

The NullPointer "Cannot read field file because is null" indicates that this is the same bug we can reproduce and we're currently analyzing.

@hg-ms
Copy link
Contributor

hg-ms commented Oct 13, 2021

Is this a bug that is a high priority for you and you are currently working on a solution?

Yes, we're working on that currently. But currently I can't make any estimations how long this will take.

hg-ms added a commit that referenced this issue Nov 3, 2021
commit bac8f5b
Author: hg-ms <53219833+hg-ms@users.noreply.github.com>
Date:   Fri Oct 22 10:27:59 2021 +0200

    Missed a very important line

commit ab35386
Author: hg-ms <53219833+hg-ms@users.noreply.github.com>
Date:   Fri Oct 22 08:30:38 2021 +0200

    Fixing Nullpointer in StorageEntityChache#internalCacheCheck

    this fix is related to
    #250
    microstream-one/microstream-private#588
    microstream-one/microstream-private#585
@MutenRoshi84
Copy link
Author

Is this a bug that is a high priority for you and you are currently working on a solution?

Yes, we're working on that currently. But currently I can't make any estimations how long this will take.

It's nice to hear that the cause has been found and resolved!
Is it planned or possible to release a bugfix release soon instead of waiting for the major release? That would be really great and I would be very grateful to you!

hg-ms added a commit that referenced this issue Nov 5, 2021
Fixing Nullpointer in StorageEntityChache#internalCacheCheck
NewBackupFileValidator for every channel

this fix is related to
#250
microstream-one/microstream-private#588
microstream-one/microstream-private#585
@hg-ms
Copy link
Contributor

hg-ms commented Nov 5, 2021

It's nice to hear that the cause has been found and resolved!
Is it planned or possible to release a bugfix release soon instead of waiting for the major release? That would be really great and I would be very grateful to you!

We plan to do a minor release containing that fix. Please apologize that I can't tell when this will be available at the moment.

@hg-ms hg-ms modified the milestone: 06.01.00 Nov 11, 2021
@hg-ms
Copy link
Contributor

hg-ms commented Nov 16, 2021

Hello,
We just released the new Version 06.01.00-MS-GA that contains several bug fixes including fixes for this issue.

@fh-ms fh-ms added this to the 06.01.00 milestone Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants