No transaction is active on this connection - I/O Error

I’ve got a backup to a Google Cloud Storage bucket that’s been chugging along for at least a year, and suddenly a couple days ago started getting this error:

unknown error No transaction is active on this connection

Checking the system logs gives this:

Dec 23, 2021 2:15 PM: Failed while executing "Backup" with id: 6
code = Unknown (-1), message = System.Data.SQLite.SQLiteException (0x80004005): unknown error
No transaction is active on this connection
   at System.Data.SQLite.SQLiteTransactionBase.IsValid(Boolean throwError)
   at System.Data.SQLite.SQLiteTransaction.Commit()
   at Duplicati.Library.Main.Operation.Common.DatabaseCommon.Dispose(Boolean isDisposing)
   at Duplicati.Library.Main.Operation.BackupHandler.<RunAsync>d__20.MoveNext()

As to other relevant info and things that I’ve tried, I’m running the current beta (2.0.6.3_beta_2021-06-17) on Windows 10.

I basically have two identical backup sets, one that is pointing to the aforementioned Google Cloud Storage bucket, and the other that is pointing to a local external hard drive (and is working fine).

I set up a small test backup set to a different Google Cloud bucket, so it doesn’t seem to be a Google Cloud issue.

Of course, I’ve rebooted my system.

Running a repair results in the following, so I haven’t tried to recreate the database (yet):

Destination and database are synchronized, not making any changes

The drive where the database is located has 40 GB of free space.

“Create bug report” results in the following error:

Dec 23, 2021 2:32 PM: Failed while executing "CreateReport" with id: 6
System.IO.IOException: Data error (cyclic redundancy check).

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
   at Duplicati.Library.Main.Operation.CreateBugReportHandler.Run()
   at Duplicati.Library.Main.Controller.RunAction[T](T result, String[]& paths, IFilter& filter, Action`1 method)
   at Duplicati.Library.Main.Controller.CreateLogDatabase(String targetpath)
   at Duplicati.Server.Runner.Run(IRunnerData data, Boolean fromQueue)

Per the suggestion here, I checked my drives with CrystalDiskInfo, and all is good.

Trying to “verify files” results in the following error:

code = IoErr (10), message = System.Data.SQLite.SQLiteException (0x800007FF): disk I/O error
disk I/O error
   at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
   at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
   at System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
   at Duplicati.Library.Main.Database.ExtensionMethods.ExecuteReader(IDbCommand self, Boolean writeLog, String cmd, Object[] values)
   at Duplicati.Library.Main.Database.LocalDatabase.VerifyConsistency(Int64 blocksize, Int64 hashsize, Boolean verifyfilelists, IDbTransaction transaction)
   at Duplicati.Library.Main.Operation.TestHandler.Run(Int64 samples)
   at Duplicati.Library.Main.Controller.RunAction[T](T result, String[]& paths, IFilter& filter, Action`1 method)
   at Duplicati.Library.Main.Controller.Test(Int64 samples)
   at Duplicati.Server.Runner.Run(IRunnerData data, Boolean fromQueue)

After writing the above, I solved the problem, but decided to post it and the solution anyway in case someone else has the same issue.

Some more searching led me to this thread. As far as I could tell, nothing was locking the file, but when I tried to make a copy of the file, the copy process would error out, which led me to believe that perhaps the file was corrupted. I was, however, able to rename the file, and then ran a repair. Despite some of the horror stories I’ve read on here about database recreation taking forever, mine only took about an hour (my backup set is 250 GB).

After the repair, everything is working fine! :partying_face:

Glad you solved the problem! Thank you for keeping this post and following up with your solution.

I’m a little worried about the health of that drive, given OS-level errors to Duplicati and your copy attempt.
SMART doesn’t spot everything. Duplicati doesn’t normally even have a job’s DB open when not using it.
You can get extra sure of that by stopping Duplicati. If the file still errors out (how?) during copy, bad sign.

How Do I Fix a Cyclic Redundancy Check Error When I Try to Copy a File?

Probably good news, but not conclusive. If the drive is actually giving errors, that seems bad…

What SMART Stats Tell Us About Hard Drives

That means that 23.3% of failed drives showed no warning from the SMART stats we record.

Thanks for the advice. I’ll try to keep a closer eye on things. All the more reason to make sure my backups are running smoothly! :slightly_smiling_face: :crossed_fingers:

Personally, the Disk I/O error probably isn’t anything to worry about here. I had that from the Duplicati db file being backed up on one computer with a drive bought last year. Excluding the file as well as all /AppData and its been all good ever since.

Technically, for where it throws the error on that for me, the Duplicati code doesn’t deal with possible errors being thrown there. That would be a Duplicati problem especially since it happens on its own db file, not a drive problem.

If the drive had a problem, you will know lol.

Exactly? I see no post on your System.IO.IOException: Data error (cyclic redundancy check)..
Google search for description found lots of sites trying to promote some claimed special cures for these. Personally I’m skeptical about most of them, but they illustrate the point that these are not just Duplicati’s.

There’s also the below, which I guess was File Explorer or some similar tool. I wonder if it’s reproducible without Duplicati being up? If the original tool gives vague errors, I wonder if copy command does better?

Maybe we’re knowing now, if receptive to the hint. Drives can develop local failures that are not massive. Individual sectors can go out (maybe hurting one file) and be remapped, but SMART should show these.
I’m also seeing some people claiming that errors like these can be cables or connectors, not drive itself.

I think keeping good backups (test too) and watching for issues (or doing that test) is a worthwhile move.

Only in reference to the disk i/o error reference. That’s not always going to be a real issue to have disk i/o error show up. I don’t have a quick reference link to that anymore and my mind is on other things right now.

But, focusing on the other points could reveal something else, sure.

Don’t remember if eg cyclic redundancy check showed up at this point. A super quick search shows that it also can happen on backing up a db or corrupt db which Duplicati could do itself to cause that.

I suspect Duplicati. You suspect other things. That’s fine. Its definitely something :slight_smile:

So you could be right and it is the drive. If it is the drive CHKDSK might be good enough to fix that. Some people will recommend throwing it out anyway but that’s not me.

Just to add two quick things eg CRC error being caused and fixed programmatically as an example as its not sqlite CRC Error for actual update from 1.10.7 to 1.10.9 ? · Issue #353 · adafruit/Adafruit-GFX-Library · GitHub and a list of many things that sqlite devs have found that can cause corruption from the code How To Corrupt An SQLite Database File

Also CRC can be caused by code (other applications, virus, or whatever) altering the file and thus changing or corrupting it.

Would be nice to have a more sure cause though. I see no further need to add to this on my part.

You need to consider exact type. System.IO.IOException is broad, probably even in the disk I/O category.

If you got it when looking at collision issues between Duplicati-the-DB-reader-for-its-backup and Duplicati-the-user-of-a-DB, the exception might be helpful to understand what the exact issue is, and how to avoid, although if this is not a cyclic redundancy check, it might be possible to find details in the records already.

Google search:

“cyclic redundancy check” site:github.com/duplicati/duplicati/issues (nothing at all found)

“cyclic redundancy check” site:forum.duplicati.com (finds this and my familiar comment)

Cyclic redundanty check error on backup which actually got some CrystalDiskInfo errors.

Got a link to that cyclic redundancy check error? I didn’t find that…

This would be an application-level error not a disk-level error, e.g. Duplicati does lots of hash checks.

Here’s data that validates the integrity of destination volumes (and sometimes finds them incorrect):

If a downloaded file does not match its hash, you get application error not a System.IO.IOException.

Looks mostly SQLite-level. Disk Drive and Flash Memory Failures and below are hardware and OS. Corruption can occur at many levels. They can’t be lumped together. Exception here looks low-level.

The incorrect checksums in the Arduino Library Manager index for the Adafruit libraries have now been corrected.

sounds like an error at the application or library level of the project, not OS or hardware.

System Error Codes (0-499) within a series of device errors might describe error here:

ERROR_CRC

23 (0x17)

Data error (cyclic redundancy check).

Win32 Error Codes is a combined list. The error here is likely Windows level or below.

Agreed, and testing by @speedy1812 might give evidence, if renamed file still exists.

Main idea is: look at exact error, and context if available. Here it’s a Windows report of:

where it is already out of Duplicati, in .NET Framework, and hitting an OS-or-below problem.

I hope I’ve explained why I think it’s below Duplicati. Stack trace seems to show its level well.
I’m also still interested to know any specifics about your DB collision, if you have the chance.

Thanks!