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

Disk I/O error #71

Open
pmsobrado opened this issue Oct 31, 2023 · 7 comments
Open

Disk I/O error #71

pmsobrado opened this issue Oct 31, 2023 · 7 comments

Comments

@pmsobrado
Copy link

pmsobrado commented Oct 31, 2023

Hi @Rinnegatamante I was hoping you could help me. This is really not an issue of lpp but really I literally can't think of any other place to ask this.

Im using the Custom Live Area app that uses your lua player, and I'm getting disk I/O error on line 22 of a certain lua file:
imagen
I tried messing with the code but couldn't make it to work. Could you have any clue of what is happening?

On line 18 it should enter 74 times, those are the customized app names I have and the number of folders/item on that path. If I reduce it to 70, it works. Also, the app finds 170 titles so the general loop should repeat 170 times.

Also, tried to different SDs. I even tried without SD2VITA, directly on real internal storage.

I've opened an issue on the app's GH but it is unlikely to have an answer: AntHJ/Custom-LiveArea#4

I would appreciate any kind of comment or suggestion regarding this matter.

Thanks in advance.

@Rinnegatamante
Copy link
Owner

That is an error in sqlite (the library used for app.db database management: https://sqlite.org/forum/info/f0740edfea56d61b733d83e469a55436df66f34defb219ff806dccceb0e086eb

It's not an issue related specifically to lpp-vita. Either is a misusage of Database.execQuery or some Vita hard limit on the amount of edits you can do to app.db in a given time.
One thing i'd do for sure is to NOT open a db, exec a query and close it for every query to execute but instead keep the database opened and exec several queries on it.

@pmsobrado
Copy link
Author

I'm afraid I already tried to keep the db open for the whole loop, and also tried to add a delay between queries, even one minute between them, but it keeps failing on the same line with the same error :S

I'm not completely sure if the error is on the db query or the file reading just above it...

@pmsobrado
Copy link
Author

Hmm, weird, I removed 11 old renaming of the app and now instead of 74 I have 63, and the same thing happens, but is does not happens if I remove one and leave it to 62... also, if opening and closing db only once at first and at the end, I get "library routine called out of sequence" when a second query triggers.

@Rinnegatamante Rinnegatamante reopened this Nov 1, 2023
@Rinnegatamante
Copy link
Owner

Can you give me a simple reproducible example script that gives the "library routine called out of sequence" error?

@pmsobrado
Copy link
Author

Yes, this is what I tried:

currentapp=0
percentage=0

for j, file	in pairs(AppTitleID) do

	db = Database.open("ur0:shell/db/app.db")
	
	System.wait(500000)
	
	currentapp=currentapp+1
	percentage=(currentapp/appcount*100)*3
	Graphics.initBlend()
	Screen.clear()
	Graphics.drawImage(0,0,Background)
	Graphics.fillRect(329, 631, 269, 301, white)
	Graphics.fillRect(330, 630, 270, 300, black)
	Graphics.fillRect(330, (330+percentage), 270, 300, green)
	Graphics.debugPrint(330,200, "Scanning app "..currentapp.." of "..appcount.."", white)
	Graphics.debugPrint(330,230, ""..file.titleId.."", white)	
	Graphics.termBlend()
	Screen.flip()

	if System.doesFileExist("ux0:data/CustomLiveArea/"..file.titleId.."/"..file.titleId.."") then	
	RemName = io.open("ux0:data/CustomLiveArea/"..file.titleId.."/"..file.titleId.."", "r")
	newAppName = RemName:read()
	-- db = Database.open("ur0:shell/db/app.db")
	query = Database.execQuery(db, "UPDATE tbl_appinfo_icon set title = '"..newAppName.."' WHERE titleid = '"..file.titleId.."'")
	-- Database.close(db)		
	end
	
	if System.doesFileExist("ux0:/data/CustomLiveArea/"..file.titleId.."/icon0.png") then
	-- db = Database.open("ur0:shell/db/app.db")
	query = Database.execQuery(db, "UPDATE tbl_appinfo_icon set iconPath = 'ux0:data/CustomLiveArea/"..file.titleId.."/icon0.png' WHERE titleid = '"..file.titleId.."'")
	-- Database.close(db)
	end
	
	pageexist=0
	if System.doesFileExist("ux0:/data/CustomLiveArea/"..file.titleId.."/PAGE") then pageexist=1 end

	if pageexist==1 then
	-- db = Database.open("ur0:shell/db/app.db")
	query = Database.execQuery(db, "UPDATE tbl_livearea set org_path = 'ux0:data/CustomLiveArea/"..file.titleId.."' WHERE titleid = '"..file.titleId.."'")
	-- Database.close(db)
	-- db = Database.open("ur0:shell/db/app.db")
	query = Database.execQuery(db, "UPDATE tbl_appinfo set val = 'ux0:data/CustomLiveArea/"..file.titleId.."' WHERE key = '2630610402' AND titleId = '"..file.titleId.."'")
	-- Database.close(db)
	end

	buttonexists=0
	if System.doesFileExist("ux0:/data/CustomLiveArea/"..file.titleId.."/BUTTON") then buttonexists=1 end

	if buttonexists==1 then
	-- db = Database.open("ur0:shell/db/app.db")
	query = Database.execQuery(db, "UPDATE tbl_livearea set org_path = 'ux0:data/CustomLiveArea/"..file.titleId.."' WHERE titleid = '"..file.titleId.."'")
	-- Database.close(db)
	-- db = Database.open("ur0:shell/db/app.db")
	query = Database.execQuery(db, "UPDATE tbl_appinfo set val = 'ux0:data/CustomLiveArea/"..file.titleId.."' WHERE key = '2630610402' AND titleId = '"..file.titleId.."'")
	-- Database.close(db)
	end
	
	Database.close(db)
	
end
dofile("app0:db.lua")

@Rinnegatamante
Copy link
Owner

You are still opening and closing the database countless times.

@pmsobrado
Copy link
Author

Yep, tried it out of the loop but gave me the same result :S

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants