LC loses I/O ability about once a day

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

MichaelBluejay
Posts: 168
Joined: Thu Jul 01, 2010 11:50 am

LC loses I/O ability about once a day

Post by MichaelBluejay » Sat Oct 26, 2019 6:44 am

About once a day, I get an error when my stack tries to open the database ("Database Error: Unable to open the database file").

At that point I try to save my stack and close it, but when trying to save, I get a similar error: "Can't save stack [stack name] due to an error: can't open stack file".

I can live with the inconvenience in the IDE, but I can expect bad reviews for my product once it ships if the standalone suffers the same problem of randomly refusing to open the database file.

Do others suffer the same problem, and is there a treatment?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7252
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: LC loses I/O ability about once a day

Post by FourthWorld » Sat Oct 26, 2019 6:54 am

Haven't seen these myself, nor heard of similar symptoms, so that's the good news. The bad news is that you're experiencing them, and it's a serious drag. Let's see what we can do to remedy this.

Which DB type?
Which LC version?
Which OS version?

Is the stack that has trouble saving on your main disk, or a mounted volume? If the latter, how is it mounted (SATA/internal, USB, network)?

Are there any Unicode characters in the path to the stack file?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

MichaelBluejay
Posts: 168
Joined: Thu Jul 01, 2010 11:50 am

Re: LC loses I/O ability about once a day

Post by MichaelBluejay » Sat Oct 26, 2019 6:59 am

The DB is SQLite, but I don't think the DB is an issue, it's a symptom, because when LC refuses to open the database connection, LC also can't even save the stack. Though maybe I'm wrong, and the I/O for SQLite is screwing up I/O in general.

LC 9.5.0, Build 15503 on Mac OS 10.13.6.

Stack is on my local volume, DB file is on my iCloud Drive. File names are ASCII. Stack filename contains a space, DB filename doesn't.

MichaelBluejay
Posts: 168
Joined: Thu Jul 01, 2010 11:50 am

Re: LC loses I/O ability about once a day

Post by MichaelBluejay » Mon Oct 28, 2019 2:55 am

Happened just now, same exact symptom. I've been entering data into an LC form for about the last hour, which saves to an SQLite database, about 3 saves per minute. One minute I'm entering transactions, the next minute LC suddenly can't open the database or save the stack. Have to quit and restart LC.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7252
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: LC loses I/O ability about once a day

Post by FourthWorld » Mon Oct 28, 2019 3:46 am

The stack thing is super-weird. Do you see this with other stack files, or just this one?

As for the DB file, is a local file synced with iCloud, or living only in the cloud?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

MichaelBluejay
Posts: 168
Joined: Thu Jul 01, 2010 11:50 am

Re: LC loses I/O ability about once a day

Post by MichaelBluejay » Mon Oct 28, 2019 7:00 am

I always have two stacks open, the software I'm developing, and one to keep all my notes. When LC loses I/O, it loses all I/O: my SQLite database, and both stacks. Both stacks are on my machine's SSD.

My understanding about iCloud Drive is that it's not possible to have a file only in the cloud, the Mac always keeps a local copy of anything you put on the iCloud Drive.

Incidentally, my I/O problem just happened *again*. Last time was just a few hours ago.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7252
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: LC loses I/O ability about once a day

Post by FourthWorld » Tue Oct 29, 2019 2:28 am

There's a wealth of info around the web about the pitfalls of storing SQLite files in folders managed by syncing services like Dropbox, iCloud, etc. But most of those discuss corruption, and usually when more than one device is involved.

Your specifics are not something I've heard of before, but I wonder if it improves things to move the SQLite file out of your iCloud folder to some other location untouched by such services. If nothing else, it'll at least narrow down the range of possible causes.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

MichaelBluejay
Posts: 168
Joined: Thu Jul 01, 2010 11:50 am

Re: LC loses I/O ability about once a day

Post by MichaelBluejay » Tue Oct 29, 2019 3:51 am

Interesting, I was unaware of that issue. It seems like the problem is writing to the file while the system is trying to sync it between local and cloud, which could understandably cause corruption. I don't think that should be an issue for me, because my understanding is that I'm writing locally and the system periodically uploads it to the cloud. I'm writing to "~/Library/Mobile Documents/myfile.db" on my Mac. I don't even know how to write to the iCloud Drive directly.

In any event, my problem isn't the database file getting corrupted, it's LC suddenly failing to do *any* kind of file I/O, even with stack files.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7252
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: LC loses I/O ability about once a day

Post by FourthWorld » Tue Oct 29, 2019 4:46 am

MichaelBluejay wrote:
Tue Oct 29, 2019 3:51 am
In any event, my problem isn't the database file getting corrupted, it's LC suddenly failing to do *any* kind of file I/O, even with stack files.
Understood, but please humor me for a test session. The way iCloud is deeply embedded in the file system messaging routines may have an unexpected side effect with a complex paging format like sqlite.

It may not make a difference to move the file elsewhere for testing. But the symptoms you're experiencing are so unusual that I can't quite rule out even non-intuitive things just yet.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

MichaelBluejay
Posts: 168
Joined: Thu Jul 01, 2010 11:50 am

Re: LC loses I/O ability about once a day

Post by MichaelBluejay » Tue Oct 29, 2019 5:43 am

I already moved my db file onto my SSD, but I can't really test apples to apples. For the last several days I've been entering data, and now the data entry is done, so I won't be using my stack for hours a day as I've been doing recently.

MichaelBluejay
Posts: 168
Joined: Thu Jul 01, 2010 11:50 am

Re: LC loses I/O ability about once a day

Post by MichaelBluejay » Fri Nov 22, 2019 2:06 am

Just an update. I think the error returned yesterday, with a local file, but I can't be sure. When I got a DB error, I thought it was a corrupted DB, but I couldn't find any corruption with my DB viewer app. I quit LC and restarted, and then I could load the DB fine.

Also, my note-taking stack uses SQLite, with the DB file on my iCloud drive, and over many months I've never had this I/O problem with that stack, even though I use it every day.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7252
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: LC loses I/O ability about once a day

Post by FourthWorld » Fri Nov 22, 2019 4:02 am

Using iCloud with a SQLite database is possible only if your app uses Core Data to manage that database. Accessing live database files in iCloud using the SQLite interfaces is not supported and will likely corrupt your database.
Quoted from Apple docs at:
https://stackoverflow.com/questions/700 ... for-sqlite
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

MichaelBluejay
Posts: 168
Joined: Thu Jul 01, 2010 11:50 am

Re: LC loses I/O ability about once a day

Post by MichaelBluejay » Fri Nov 22, 2019 4:41 am

Like I said, I don't have a problem with my Notepad db that's been in the cloud for months, but LC loses I/O capability *besides* SQLite db, and seemingly even if the db file is stored locally.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7252
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: LC loses I/O ability about once a day

Post by FourthWorld » Fri Nov 22, 2019 7:42 am

Do you have a non-cloud recipe for either the DB or stack file issues?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

MichaelBluejay
Posts: 168
Joined: Thu Jul 01, 2010 11:50 am

Re: LC loses I/O ability about once a day

Post by MichaelBluejay » Fri Nov 22, 2019 7:52 am

Would have posted it if I did.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”