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

AfsExceptionExclusiveAttemptConflict: File is already used by a different exclusive user on restart #282

Closed
hg-ms opened this issue Nov 17, 2021 · 1 comment · Fixed by #284
Assignees
Labels
bug Something isn't working
Milestone

Comments

@hg-ms
Copy link
Contributor

hg-ms commented Nov 17, 2021

Caused by: one.microstream.afs.exceptions.AfsExceptionExclusiveAttemptConflict: File is already used by a different exclusive user: one.microstream.afs.types.AFile$Default@6327b54d("storage/channel_3/transactions_3.sft"). Exclusive user: (java.lang.Thread@8674c87) Thread[MicroStream-StorageChannel-3,5,]. Attempting user: (java.lang.Thread@6a0b3fb) Thread[MicroStream-StorageChannel-3,5,main].
	at one.microstream.afs.types.AccessManager$Default$2.handleExclusiveAttemptConflict(AccessManager.java:776)
	at one.microstream.afs.types.AccessManager$Default.internalUseWriting(AccessManager.java:664)
	at one.microstream.afs.types.AccessManager$Default.useWriting(AccessManager.java:497)
	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:1117)
	at one.microstream.storage.types.StorageFileManager$Default.readTransactionsFile(StorageFileManager.java:727)
	at one.microstream.storage.types.StorageFileManager$Default.readStorage(StorageFileManager.java:712)
	at one.microstream.storage.types.StorageChannel$Default.readStorage(StorageChannel.java:745)
	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:222)
	at one.microstream.storage.types.StorageChannel$Default.work(StorageChannel.java:422)
	at one.microstream.storage.types.StorageChannel$Default.run(StorageChannel.java:509)
	at java.lang.Thread.run(Thread.java:748)

After fixing #279 that exception gets reproducible thrown after restarting a storage several times if the continuous Backup is enabled.

The Exception is thrown because the AccessManager instance does not deregister the affected file on shutdown. At the next restart the error is caused.

@hg-ms hg-ms added the bug Something isn't working label Nov 17, 2021
@hg-ms hg-ms self-assigned this Nov 17, 2021
@hg-ms
Copy link
Contributor Author

hg-ms commented Nov 17, 2021

Here is why the transaction log file is not released during the shutdown:

The shutdown in the StorageSystem class has several steps:

  1. The continuous backup is stopped
  2. The channels are stopped
  3. When all channels are stopped successfully the StorageOperationController gets disabled.

The StorageOperationController gets stopped in StorageChannelTaskShutdown.Default.succeed(StorageChannel, Void)
The continuous backup has a dependency to the StorageOperationController therefore it gets stopped first.
When the Backup gets stopped the StorageBackupHandler will process all currently enqueued items before it will stop. But after that it is still possible that the still active StorageChannels enqueue new backup tasks. Those tasks are created during the housekeeping phase of the storage channels.
With the backup-handler already disabled those tasks won’t be processed any more an the “release” of the related files in the AccessManager will not happen.

@hg-ms hg-ms added this to the 07.00.00 milestone Nov 30, 2021
@hg-ms hg-ms linked a pull request Nov 30, 2021 that will close this issue
hg-ms added a commit that referenced this issue Nov 30, 2021
fh-ms pushed a commit that referenced this issue Oct 11, 2022
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

Successfully merging a pull request may close this issue.

1 participant