Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
06821 Plugins Minor Always Jan 3, 2018, 16:46 Jan 14, 2018, 11:15
Tester Firewave View Status Public Platform MAME (Self-compiled)
Assigned To Resolution No change required OS Linux (64-bit)
Status [?] Closed Driver
Version 0.193 Fixed in Version Build 64-bit
Summary 06821: LUA ERROR in timer plugin on start-up (Non-Windows only)
Description
[LUA ERROR] in execute_function: plugins/timer/init.lua:62: attempt to index a nil value (local 'stmt')
Steps To Reproduce - enable the "Timer plugin"
- restart MAME
Additional Information Linux only issue. Windows normal binary and SDL Windows doesn't not happen.
Flags SDL specific
Regression Version
Affected Sets / Systems
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
15
User avatar
No.14611
Tafoid
Administrator
Jan 3, 2018, 17:53
This doesn't seem to happen regular Window binary nor an OSD=sdl build. Can anyone else with Linux confirm?
User avatar
No.14614
wuemura
Viewer
Jan 3, 2018, 21:28
Confirmed.
User avatar
No.14650
Firewave
Senior Tester
Jan 11, 2018, 12:59
Same error when having the mameinfo.dat present
[LUA ERROR] in execute_function: plugins/data/load_dat.lua:130: attempt to index a nil value (local 'stmt')
User avatar
No.14655
crazyc
Developer
Jan 12, 2018, 14:44
edited on: Jan 12, 2018, 14:45
Which distro are you using? Are you building against shared sqlite? FWIW, it works for me with my own build in Fedora.
User avatar
No.14656
Firewave
Senior Tester
Jan 12, 2018, 17:21
edited on: Jan 12, 2018, 17:26
I am using official clang 5.0.1 binaries on ubuntu 16.04 and I do a regular compile (aside from the sanitizer stuff) so it should use the bundle sqlite3.

So if there is something wrong with the sqlite hookup maybe that explains why I cannot reproduce this sqlite3 sanitizer error that was reported on GitHub - https://github.com/mamedev/mame/issues/3022
User avatar
No.14657
crazyc
Developer
Jan 12, 2018, 18:52
Any chance you can upload a compiled binary somewhere?
User avatar
No.14658
Firewave
Senior Tester
Jan 12, 2018, 20:55
edited on: Jan 13, 2018, 00:37
Using db:errmsg() I got the following (same for both issues).
no such table: mameinfo.dat

I checked all db:* calls for error message and the CREATE queries fail with
database is locked 

I deleted the *.db files and then it failed in in the "SELECT VERSION" prepare with
no such table: version

In data/database.lua the first select failed with
no such table: sqllite_master 
and the CREATE TABLE failed with
database is locked 
User avatar
No.14659
Firewave
Senior Tester
Jan 12, 2018, 22:39
edited on: Jan 12, 2018, 22:40
It appears to be a permissions problem
open("plugins/data/load_dat.lua", O_RDONLY) = 19
close(19) = 0
open("plugins/data/load_dat.lua", O_RDONLY) = 19
fstat(19, {st_mode=S_IFREG|0755, st_size=4730, ...}) = 0
read(19, "local datfile = {}\r\nlocal db, sq"..., 16384) = 4730
read(19, "", 16384) = 0
close(19) = 0
open("plugins/data/database.lua", O_RDONLY) = 19
close(19) = 0
open("plugins/data/database.lua", O_RDONLY) = 19
fstat(19, {st_mode=S_IFREG|0755, st_size=907, ...}) = 0
read(19, "local sql = require(\"lsqlite3\")\r"..., 16384) = 907
read(19, "", 16384) = 0
close(19) = 0
lstat("history/history.db", 0x7fffb56c5618) = -1 ENOENT (No such file or directory)
getcwd("/mnt/mame", 511) = 10
stat("/mnt/mame/history/history.db", 0x7fffb56c54a0) = -1 ENOENT (No such file or directory)
open("/mnt/mame/history/history.db", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = -1 ENOENT (No such file or directory)
open("/mnt/mame/history/history.db", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
mkdir("history", 0775) = 0
lstat("history/history.db", 0x7fffb56c5618) = -1 ENOENT (No such file or directory)
getcwd("/mnt/mame", 511) = 10
stat("/mnt/mame/history/history.db", 0x7fffb56c54a0) = -1 ENOENT (No such file or directory)
open("/mnt/mame/history/history.db", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = 19
fstat(19, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
stat("/mnt/mame/history/history.db", {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
lseek(19, 0, SEEK_SET) = 0
read(19, "", 100) = 0
write(2, "open not an error\n", 18open not an error
) = 18
fcntl(19, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
fcntl(19, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = 0
fcntl(19, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
stat("/mnt/mame/history/history.db-journal", 0x7fffb56c4c00) = -1 ENOENT (No such file or directory)
fstat(19, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
unlink("/mnt/mame/history/history.db-wal") = -1 ENOENT (No such file or directory)
fstat(19, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
brk(0xd955000) = 0xd955000
fcntl(19, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fcntl(19, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
fcntl(19, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = 0
fcntl(19, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
stat("/mnt/mame/history/history.db-journal", 0x7fffb56c5370) = -1 ENOENT (No such file or directory)
fstat(19, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
unlink("/mnt/mame/history/history.db-wal") = -1 ENOENT (No such file or directory)
fstat(19, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
fcntl(19, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
write(2, "select no such table: sqllite_ma"..., 37select no such table: sqllite_master
) = 37
fcntl(19, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
fcntl(19, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = 0
fcntl(19, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
stat("/mnt/mame/history/history.db-journal", 0x7fffb56c51e0) = -1 ENOENT (No such file or directory)
fstat(19, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
fstat(19, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
unlink("/mnt/mame/history/history.db-wal") = -1 ENOENT (No such file or directory)
fstat(19, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
fcntl(19, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=1073741825, l_len=1}) = 0
stat("/mnt/mame/history/history.db", {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
open("/mnt/mame/history/history.db-journal", O_RDWR|O_CREAT|O_CLOEXEC, 0755) = 20
fstat(20, {st_mode=S_IFREG|0755, st_size=0, ...}) = 0
geteuid() = 1000
open("/dev/urandom", O_RDONLY|O_CLOEXEC) = 21
read(21, "\25\326\260\260\351\360\205\343\34z\253\232\314\10\20jN|\353\357\345Zj*\273\23b\377\217\26i'"..., 256) = 256
close(21) = 0
lseek(20, 0, SEEK_SET) = 0
write(20, "\0\0\0\0\0\0\0\0\0\0\0\0\316R\220\345\0\0\0\0\0\0\2\0\0\0\20\0\0\0\0\0"..., 512) = 512
fcntl(19, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=1}) = 0
fcntl(19, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = -1 EACCES (Permission denied)
fstat(20, {st_mode=S_IFREG|0755, st_size=512, ...}) = 0
fstat(20, {st_mode=S_IFREG|0755, st_size=512, ...}) = 0
lseek(20, 496, SEEK_SET) = 496
read(20, "\0\0\0\0", 4) = 4
lseek(20, 8, SEEK_SET) = 8
read(20, "\0\0\0\0", 4) = 4
lseek(20, 12, SEEK_SET) = 12
read(20, "\316R\220\345", 4) = 4
lseek(20, 16, SEEK_SET) = 16
read(20, "\0\0\0\0", 4) = 4
lseek(20, 20, SEEK_SET) = 20
read(20, "\0\0\2\0", 4) = 4
lseek(20, 24, SEEK_SET) = 24
read(20, "\0\0\20\0", 4) = 4
fstat(20, {st_mode=S_IFREG|0755, st_size=512, ...}) = 0
lseek(20, 496, SEEK_SET) = 496
read(20, "\0\0\0\0", 4) = 4
close(20) = 0
unlink("/mnt/mame/history/history.db-journal") = 0
fcntl(19, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = 0
fcntl(19, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=1073741824, l_len=2}) = 0
fcntl(19, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
write(2, "CREATE TABLE 5 database is locke"..., 34CREATE TABLE 5 database is locked
) = 34
Strange thing is, that it can create the history folder and a 0-byte history.db file in it. I also have no other issues with MAME creating files.

ls -ld history
drwxr-xr-x 2 user user 0 Jan 12 23:36 history

ls -l history
total 0
-rwxr-xr-x 1 user user 0 Jan 12 23:36 history.db
User avatar
No.14660
crazyc
Developer
Jan 13, 2018, 00:16
fcntl(19, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=1073741826, l_len=510}) = -1 EACCES (Permission denied)

It's not file creation that's the problem it's this call should succeed (and does on my computer). What filesystem is /mnt/mame?
User avatar
No.14661
Firewave
Senior Tester
Jan 13, 2018, 00:20
I am running it in a VM from a mounted Windows share - so CIFS.
User avatar
No.14662
crazyc
Developer
Jan 13, 2018, 00:28
edited on: Jan 13, 2018, 00:35
Seems sqlite and cifs don't get along http://sqlite.1065341.n5.nabble.com/How-to-make-SQLite-run-safely-on-CIFS-mounted-file-system-td37415.html . Don't think there's anything we can do about it.

Here's a better link that has the same problem as you are seeing http://sqlite.1065341.n5.nabble.com/sqlite-db-is-locked-on-network-drive-td77871.html . You might be able to use the nobrl mount option to get it to work.
User avatar
No.14663
Firewave
Senior Tester
Jan 13, 2018, 00:36
Bummer - but some more error handling in those scripts wouldn't hurt ... I could do that.

I tried changing the path by setting the option which I thought was available based on this lua code
mame_manager:ui():options().entries.historypath:value()
But it seems that is not a public option available via the command-line.

I hard-coded it and it works now, although there is still a small error in database.lua - the table check seems wrong so it will always try to create the table.

no such column: version
table version already exists
The same pattern is also used in timer/init.lua, so it needs fixing there as well.

Thanks for looking into this.
User avatar
No.14664
crazyc
Developer
Jan 13, 2018, 00:47
edited on: Jan 13, 2018, 00:50
historypath is in ui.ini dunno how to change it from the command line. Also, I think i fixed the table check https://github.com/mamedev/mame/commit/e94b4d2bac87743d221a3ffa38a1a98b7f16e606 .
User avatar
No.14665
wuemura
Viewer
Jan 14, 2018, 02:57
edited on: Jan 14, 2018, 03:07
I confirm a fix for this one with the latest git:
https://github.com/mamedev/mame/issues/3022

Patch that fixed:
https://github.com/mamedev/mame/pull/3061

Thank you both.
User avatar
No.14667
Firewave
Senior Tester
Jan 14, 2018, 11:15
Using the nobrl option fixed the problem.