Problem of SQLite3::SQLException: SQL logic error or missing database - sqlite

SQLite3::SQLException: SQL logic error
or missing database
error when do insert, update and delete operation to tables from browser( that means the create, update and destroy action is failed but the show action is fine ), the same operation in console is OK. I googled this problem and found most of the solutions is to remove duplication in the fixtures, so I removed all the test data from the fixture and restart the server, and it failed again:(
Any advise is appreciated.

It turned out that I forget use "sudo script/server" to get write permission to the database :)

I don't mean to resurrect the dead, but I just encountered this problem, and the popular answers I found did not apply.
My problem turned out to be the SQLite Manager add-on for Firefox. I used the SysInternals "handle" program to determine that a) Firefox/SQLiteManager had (I assume) an open transaction, and b) every time I used the add-on to connect to the database, it did not destroy the previous one, which was no longer accessible.
I exited Firefox, and my code ran fine. I loaded Firefox and SQLite Manager again, but did not begin a transaction; again, my code ran fine. My code was Python, not RoR.
I would recommend this answer, and the original question be tagged for [sqlite3]. It's definitely not specific to RoR.

This might not be the right place for my observation, but:
I spent some hours to find a problem having two C++ threads connected to one database.
For some stupid reason I was executing a COMMIT from one thread being meant to be executed on the other side.
The commit worked well, but the other thread immediately had AUTO COMMIT being set to true.

Related

Database Corruption - Disk Image Is Malformed - Unraid - Plex [migrated]

This question was migrated from Stack Overflow because it can be answered on Super User.
Migrated 17 days ago.
I am not sure where a question like this really falls as it is from an Unraid Linux server, with a Plex Media Server container, which utilizes SQLite (looking for troubleshooting at the root level). I have posted in both Unraid, and Plex forums with no luck.
My Plex container has been failing time and time again on Unraid resulting in me doing integrity checks, rebuilds, dump, import, and a complete wipe and restart (completely remove old directory and start over). At best I get it up for a few minutes before the container fails again. The errors I am receieving have changed but as of the last situation (complete wipe and reinstall of a new container) I am getting the following error in the output log:
Error: Unable to set up server:
sqlite3_statement_backend::loadOne:database disk image is malformed
(N4soci10soci_errorE)
I decided to copy the database onto my windows machine and poke around the database to get a better understanding of the structure. Upon viewing a table called media_items I get the same error.
Clearly one of what I assume to be main tables is corrupt. The question I have then is what if anything can I do to try and fix this or learn about the cause? I would have thought a completely new database would fix my issue, unless it's purely coincidence two back to back databases became corrupted before I could even touch them, with no connection. Could it be one of my media files? Could it be Unraid? Could it be my hard drive?
For context, if unfamiliar with Plex. Once the container is up, it scans my media library and populates it with data such as metadata, posters, watch state, ratings, etc. I get through the full automated build and within 30 minutes it falls apart before I can even customize my library.
Below are references to the bash lines I used in several scenarios throughout troubleshooting. May be useful to someone somewhere.
Integrity Check:
./Plex\ SQLite "$plexDB" "PRAGMA integrity_check"
Recover From Backup:
./Plex\ SQLite "$plexDB" ".output recover.out" ".recover"
Dump:
./Plex\ SQLite "$plexDB" ".output dump.sql" ".dump"
Import:
./Plex\ SQLite "$plexDB" ".read dump.sql"
After hours, days, and a week of all kinds of troubleshooting. To include resetting the docker image (plus others mentioned in the post), it was suggested in another forum to run a memtest. Put memtest on a bootable USB and I was immediately able to conclude one stick was bad. Upon removing that stick I have zero issues and everything is completely fine... Bizarre.

WorldServer or DataBase Broken Update?

Since an update I made this saturday, here are all the errors I get when launching the worldserver (take care, it's very long!) :
>>>> https://pastebin.com/0vQYjMJr
Is there a way to rollback to the last update I made a week ago? Note that I got all the SQL DB install files and SQL updates downloaded via a regular 'git pull' I made each week, but no DB Backup Export.
So, today I need to rollback to the last compile I made and be sure that the SQL updates will stop to the the last date of my compile, not the last of this saturday. I will try some, and get back here
Hope you will reply quickly
V.
OK, found this : https://github.com/azerothcore/azerothcore-wotlk/issues/9763
It's just a bug. In fact, the server is still running correctly. Maybe an update will fix it soon.

CreateObject randomly fails since recent windows security update that does not seem related

We use MSWC.BrowserType (browscap.dll) in our classic asp website to help identify user agents.
Since July 21 our code began to throw Server.CreateObject failed errors when trying to create this object.
It works most of the time, but randomly fails several times each day.
I was on vacation when the problem began, I know we didn't change anything in our code or system configuration, the only thing I see is the windows update kb3079904 that was installed on the July 21, but it does not seems related because it is about font driver !?
I wonder if someone else have the same problem or have an idea how to solve it, I did some research about intermittent createobject failing but didn't find anything relevant.
I may try to restore the system to the checkpoint before this update to see if it is really the cause, but this is an important security update and I will have to re-install it after so it may not solve the problem.
It turned out to be related to this other post, object creation failed because the component likely uses the cookie collection.
Response.Cookies collection seems corrupted and causes error

Websphere Application Server - Oracle 11g DB compatibility issue

I have been given an ad hoc reporting tool from another individual that has successfully deployed it to the field. He uses Web Logic servers and an Oracle database.
I tried to deploy the same application in my local environment (WAS 7 and Oracle). The first report runs flawlessly. However, when I run the second (or third or fourth) report, I get a very strange error: the second report is appended to the first report.
There is nothing in the code to account for this. This problem can be temporarily solved by stopping and starting the servers every time a report is run (obviously not a real solution). I think this has something to do with data sources and cached information. I then took a step back and tried to deploy it to a Tomcat server. It works perfectly, just like it does in the field. So my question is: are there any known issues between WAS 7 and Oracle 11g that could be causing this kind of problem? Any information would be very helpful.
Please ask about any specifics you may want to know and I will do my best to provide that information.
Thank you for your time.
EDIT: For anyone else looking into this, the problem was due to an incompatibility with the proprietary Oracle calls and Websphere. Once the application was edited to use only JDBC calls, everything works perfectly. Thanks.
This ended up being a incompatibility with using proprietary Oracle calls and Websphere. It was fixed by changing all of proprietary call to normal JDBC calls.

Is it possible to have the entire contents of a class that tripped an error included in the stacktrace?

A lot of time can pass between the moment a stack trace is generated and the moment the stack trace is thoroughly investigated. During that time, a lot can happen to the file in question, sometimes obscuring the original error. The error might have been fixed in the meantime (overlapping bugs).
Is it possible to get Stacktraces that show the offending file at the time of the error?
Not elegantly, and you normally don't want the user browsing through code that's throwing unexpected exceptions anyway (open door to an attacker).
Usually, what happens in a dev shop is that the user reports an error, stack trace, and the build it occurred on. As a tester, you can grab that build from your archives (you ARE keeping an archive of all supported releases somewhere handy, RIGHT?), install, run, and try to reproduce the error, working with the user to provide additional info as necessary. I've seen very few bugs that couldn't be reproduced EVENTUALLY, even if it required running the program against a backup of the user's production database to do it.
As a developer, you can download that build's source code from your version control repository (you ARE using version control, RIGHT?), and examine the lines in the stack trace to try to discover the problem by inspection, and/or build and run it to reproduce the error. Then, you go back to the latest source version, build, and run the same steps (a UI automation system can help out here), and if you don't get the error, someone else already found and fixed it. If you still get the error, you also got an updated stack trace with lines that match the current build, allowing you to set your breakpoints and step through.
What KeithS said, plus there are ways to capture more helpful state information at the time of the Exception using the Exception.Data property. See http://blog.abodit.com/2010/03/using-exception-data-to-add-additional-information-to-an-exception/
While KeithS' answer as pretty much correct, it can be easier and more elegant than you think. If you can collect a dumpfile (instead of just a stack trace), you can use a Symbol Server and Source Server in combination with your debugger to automatically pull your correct-version code from source control.
For example: if you enable PDB output and source-server integration in MSBuild, and upload the resulting PDBs to a symbol server, Visual Studio can automatically load the correct source control from a TFS or SourceSafe repository based on the information in a minidump.

Resources