Ticket #1791 (closed bug: fixed)

Opened 8 months ago

Last modified 8 months ago

sqlite locking problem

Reported by: kaliber Owned by: axeld
Priority: high Milestone: R1
Component: System/Kernel Version: R1 development
Cc: kaliber Blocked By:
Platform: All Blocking:

Description

First of all I know that sqlite is not a part of Haiku, but maybe someone could help to run sqlite on Haiku.

Here is a strace output:

SQLite version 3.4.2
Enter ".help" for instructions
[  7715] _kern_write(0x1, 0xffffffffffffffff, 0x1802c420, 0x34) = 0x00000034 (42 us)
[  7715] _kern_acquire_sem(0x59769) = 0x00000000 No error (5 us)
[  7715] _kern_release_sem(0x59769) = 0x00000000 No error (5 us)
sqlite> [  7715] _kern_write(0x1, 0xffffffffffffffff, 0x1802c420, 0x8) = 0x00000008 (46 us)
[  7715] _kern_read_stat(0x0, (nil), false, 0x7ffe664c, 0x3c) = 0x00000000 No error (40 us)
[  7715] _kern_ioctl(0x0, TCGETA, 0x7ffe65fc, 0x20) = 0x00000000 No error (20 us)

[  7715] _kern_read(0x0, 0xffffffffffffffff, 0x1802e800, 0x1) = 0x00000001 (5762338 us)
sqlite> [  7715] _kern_write(0x1, 0xffffffffffffffff, 0x1802c420, 0x8) = 0x00000008 (38 us)
CREATE table x(y text);
[  7715] _kern_read(0x0, 0xffffffffffffffff, 0x1802e800, 0x18) = 0x00000018 (10193876 us)
[  7715] _kern_resize_area(0x247de, 0x33000) = 0x00000000 No error (38 us)
[  7715] _kern_getcwd(0x18030be0, 0x1388) = 0x00000000 No error (488 us)
[  7715] _kern_open(0xffffffff, "/boot/home/sqlite-3.4.2/db", 0x8202, 0x1a4) = 0x00000003 (5589 us)
[  7715] _kern_fcntl(0x3, 0x2, 0x0) = 0x00000000 No error (171 us)
[  7715] _kern_fcntl(0x3, 0x4, 0x1) = 0x00000000 No error (9 us)
[  7715] _kern_read_stat(0x3, (nil), false, 0x7ffe6514, 0x3c) = 0x00000000 No error (28 us)
[  7715] _kern_seek(0x3, 0x0, 0x0) = 0x400000024 (26 us)
[  7715] _kern_read(0x3, 0xffffffffffffffff, 0x7ffe6748, 0x0) = 0x00000000 (16 us)
[  7715] _kern_resize_area(0x247de, 0x53000) = 0x00000000 No error (39 us)
[  7715] _kern_fcntl(0x3, 0x80, 0x7ffe6264) = 0x00000000 No error (699 us)
[  7715] _kern_fcntl(0x3, 0x80, 0x7ffe6264) = 0x00000000 No error (256 us)
[  7715] _kern_fcntl(0x3, 0x80, 0x7ffe6264) = 0x00000000 No error (328 us)
[  7715] _kern_access("/boot/home/sqlite-3.4.2/db-journal", 0x0) = 0x80006003 No such file or directory (136 us)
[  7715] _kern_read_stat(0x3, (nil), false, 0x7ffe627c, 0x3c) = 0x00000000 No error (42 us)
[  7715] _kern_fcntl(0x3, 0x80, 0x7ffe62f4) = 0x80000005 Invalid Argument (99 us)
[  7715] _kern_access("/boot/home/sqlite-3.4.2/db-journal", 0x0) = 0x80006003 No such file or directory (219 us)
[  7715] _kern_read_stat(0x3, (nil), false, 0x7ffe61cc, 0x3c) = 0x00000000 No error (55 us)
[  7715] _kern_fcntl(0x3, 0x80, 0x7ffe62f4) = 0x80000002 Permission denied (90 us)
[  7715] _kern_fcntl(0x3, 0x80, 0x7ffe6234) = 0x80000005 Invalid Argument (49 us)
SQL error: database is locked
[  7715] _kern_write(0x1, 0xffffffffffffffff, 0x1802c420, 0x1e) = 0x0000001e (39 us)
sqlite> [  7715] _kern_write(0x1, 0xffffffffffffffff, 0x1802c420, 0x8) = 0x00000008 (31 us)

Bug in fcntl?

Change History

Changed 8 months ago by axeld

  • priority changed from normal to high
  • component changed from - General to System/Kernel

Do you have a link to the part of the source of sqlite in question here? It could very well be that our fcntl() is checking its arguments incorrectly.

Changed 8 months ago by kaliber

Seems that there is only newer version (3.5.6) on sqlite.org site. Try http://downloads.openwrt.org/sources/sqlite-3.4.2.tar.gz

Changed 8 months ago by axeld

Can you please also post an executable here that I can test under Haiku? That would help me finding out what went wrong exactly - at least the sqlite source looks definitely okay.

Changed 8 months ago by kaliber

  • cc kaliber added

I don't have access to my computer now. But you can simply compile sqlite without any patches:

./configure --prefix=/boot/home/config --build=i586-pc-beos && make

./sqlite3 dbfile

sqlite> CREATE TABLE x(y TEXT);

Changed 8 months ago by axeld

Okay, thanks, I can reproduce the problem now (I thought the BeOS version would need some patches to have a work around for the missing advisory file locking implementation).

Changed 8 months ago by axeld

  • status changed from new to closed
  • resolution set to fixed

Fixed in r24020.

Changed 8 months ago by kaliber

Thanks!

Note: See TracTickets for help on using tickets.