2010-03-17 21:05:57     sqlite3 err , database is locked under 2009R1.1-RC4

Document created by Aaronwu Employee on Aug 22, 2013
Version 1Show Document
  • View in full screen mode

2010-03-17 21:05:57     sqlite3 err , database is locked under 2009R1.1-RC4

w w (CHINA)

Message: 87352   

 

hi, all

There is something wrong about sqlite3 on my bf533 stamp board under uClinux distribution 2009R1.1-RC4. I used the sqlite3 ok on uClinux distribution 2008R1-RC8.

 

The err is like this:

 

root:/> sqlite3 db

SQLite version 3.6.14.1

Enter ".help" for instructions

Enter SQL statements terminated with a ";"

sqlite> .tables

Error: database is locked

sqlite> .exit

root:/>

 

Use strace command,

 

root:/> strace sqlite3 db

execve(NULL, [0x37bfe88], [/* 0 vars */] <unfinished ...>

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20b5000

stat("/etc/ld.so.cache", {st_mode=S_IFREG|0644, st_size=965, ...}) = 0

open("/etc/ld.so.cache", O_RDONLY)      = 4

mmap2(NULL, 965, PROT_READ, MAP_PRIVATE, 4, 0) = 0x20bc000

close(4)                                = 0

open("/usr/lib/libsqlite3.so.0", O_RDONLY) = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=338084, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20bd000

read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0j\0\1\0\0\0\30a\0\0004\0\0\0\274"..., 4096) = 4096

mmap2(NULL, 327596, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE, 4, 0) = 0x2180000

mmap2(NULL, 14308, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2108000

pread(4, "\37\2\276\1\304\1\263\1V\0\"\1H\1\237\1\264\1\v\1H\1\233\0\212\1\215\0\237\1\263\1W"..., 13304, 323584) = 13304

close(4)                                = 0

munmap(0x20bd000, 4096)                 = 0

open("/lib/libdl.so.0", O_RDONLY)       = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=10196, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20bd000

read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0j\0\1\0\0\0h\v\0\0004\0\0\0,"..., 4096) = 4096

mmap2(NULL, 8820, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE, 4, 0) = 0x210c000

mmap2(NULL, 1204, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20be000

pread(4, " Trying to dlopen '%s', RTLD_GLOB"..., 1200, 8192) = 1200

close(4)                                = 0

munmap(0x20bd000, 4096)                 = 0

open("/lib/libpthread.so.0", O_RDONLY)  = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=43208, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20bd000

read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0j\0\1\0\0\0\0A\0\0004\0\0\0X"..., 4096) = 4096

mmap2(NULL, 39264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE, 4, 0) = 0x2080000

mmap2(NULL, 30328, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2118000

pread(4, "\20\346\21\0 \344/\0\20\346\23\0\"\345&\0\27\223\"\345\25\0R\221B\f\16\30\0\0\0\0\1"..., 5316, 36864) = 5316

close(4)                                = 0

munmap(0x20bd000, 4096)                 = 0

open("/lib/libgcc_s.so.1", O_RDONLY)    = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=52304, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20bd000

read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0j\0\1\0\0\0\254#\0\0004\0\0\0\220"..., 4096) = 4096

mmap2(NULL, 48352, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE, 4, 0) = 0x2090000

mmap2(NULL, 6264, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2112000

pread(4, "\1\350\0\0\20\0\0\0\0\0\0\350\0\0\1\350\0\0\0`\20\0\0\0\32\345\t\0\0\350\3\0S"..., 6104, 45056) = 6104

close(4)                                = 0

munmap(0x20bd000, 4096)                 = 0

open("/lib/libc.so.0", O_RDONLY)        = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=258356, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20bd000

read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0j\0\1\0\0\0\274\312\0\0004\0\0\0L"..., 4096) = 4096

mmap2(NULL, 250424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE, 4, 0) = 0x2140000

mmap2(NULL, 15780, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2114000

pread(4, "ECT\0--\0\0%s: option `%s' is ambigu"..., 6700, 249856) = 6700

close(4)                                = 0

munmap(0x20bd000, 4096)                 = 0

open("/lib/libdl.so.0", O_RDONLY)       = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=10196, ...}) = 0

close(4)                                = 0

open("/lib/libpthread.so.0", O_RDONLY)  = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=43208, ...}) = 0

close(4)                                = 0

open("/lib/libgcc_s.so.1", O_RDONLY)    = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=52304, ...}) = 0

close(4)                                = 0

open("/lib/libc.so.0", O_RDONLY)        = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=258356, ...}) = 0

close(4)                                = 0

open("/lib/libc.so.0", O_RDONLY)        = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=258356, ...}) = 0

close(4)                                = 0

open("/lib/libc.so.0", O_RDONLY)        = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=258356, ...}) = 0

close(4)                                = 0

open("/lib/libc.so.0", O_RDONLY)        = 4

fstat(4, {st_mode=S_IFREG|0755, st_size=258356, ...}) = 0

close(4)                                = 0

munmap(0x20bc000, 965)                  = 0

stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=30360, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20bc000

ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

getpid()                                = 280

sched_getaffinity(1, 4,  { 1 })         = 4

rt_sigaction(SIGRTMIN, {0x2119080, [], 0}, NULL, 8) = 0

rt_sigaction(SIGRT_1, {0x2118f20, [RTMIN], 0}, NULL, 8) = 0

rt_sigaction(SIGRT_2, {0x2119088, [], 0}, NULL, 8) = 0

rt_sigprocmask(SIG_BLOCK, [RTMIN], NULL, 8) = 0

rt_sigprocmask(SIG_UNBLOCK, [RT_1], NULL, 8) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x20bd000

ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

rt_sigaction(SIGINT, {0x20bb420, [INT], SA_RESTART}, {SIG_DFL, [], 0}, 8) = 0

access("db", F_OK)                      = 0

getcwd("/"..., 512)                     = 2

open("//db", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 4

fcntl64(4, F_GETFD)                     = 0

fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0

fstat64(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0

dup(4)                                  = 5

fcntl64(4, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=0, len=1}, 0x223e3e0) = -1 EACCES (Permission denied)

_llseek(4, 0, [0], SEEK_SET)            = 0

read(4, ""..., 100)                     = 0

mmap2(NULL, 53248, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x2280000

getuid32()                              = 0

open("/etc/passwd", O_RDONLY)           = 6

ioctl(6, SNDCTL_TMR_TIMEBASE or TCGETS, 0x223e6fc) = -1 ENOTTY (Inappropriate ioctl for device)

read(6, "root::0:0:root:/root:/bin/sh\nadmi"..., 256) = 64

close(6)                                = 0

open("/root/.sqliterc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)

write(1, "SQLite version 3.6.14.1\nEnter \".h"..., 98SQLite version 3.6.14.1

Enter ".help" for instructions

Enter SQL statements terminated with a ";"

) = 98

getuid32()                              = 0

open("/etc/passwd", O_RDONLY)           = 6

ioctl(6, SNDCTL_TMR_TIMEBASE or TCGETS, 0x223e6fc) = -1 ENOTTY (Inappropriate ioctl for device)

read(6, "root::0:0:root:/root:/bin/sh\nadmi"..., 256) = 64

close(6)                                = 0

write(1, "sqlite> "..., 8sqlite> )              = 8

read(0, .tables

".tables\n"..., 256)            = 8

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x3907000

fcntl64(4, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, len=1}, 0x223c738) = -1 EACCES (Permission denied)

write(2, "Error: "..

 

Any advise from you will be appreciated!

QuoteReplyEditDelete

 

 

2010-03-21 23:38:27     Re: sqlite3 err , database is locked under 2009R1.1-RC4

w w (CHINA)

Message: 87529   

 

Any suggestions ?

QuoteReplyEditDelete

 

 

2010-03-22 00:28:36     Re: sqlite3 err , database is locked under 2009R1.1-RC4

Mingquan Pan (CHINA)

Message: 87534   

 

Hi,

 

    The sqlite test is always passed in our regression test.

 

here is our logs of trunk head kernel running sqlite on bf537-stamp:

 

## Booting kernel from Legacy Image at 02000000 ...

   Image Name:   bf537-2.6.33.1-ADI-2010R1-pre-sv

   Created:      2010-03-17  23:34:20 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    5027910 Bytes =  4.8 MB

   Load Address: 00001000

   Entry Point:  0019d794

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 0019d794

Linux version 2.6.33.1-ADI-2010R1-pre-svn8476 (test@uclinux50-bf537-ad9960-ad1836) (gcc version 4.3.4 (ADI-trunk/svn-3815) ) #16 Thu Mar 18 07:33:59 CST 2010

register early platform devices

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart0] enabled

early printk enabled on early_BFuart0

Limiting kernel memory to 56MB due to anomaly 05000263

Board Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x00113800

  rodata    = 0x00113800-0x0016f8e4

  bss       = 0x00170000-0x001804b0

  data      = 0x001804b0-0x00192000

    stack   = 0x00190000-0x00192000

  init      = 0x00192000-0x0091a000

  available = 0x0091a000-0x03800000

  DMA Zone  = 0x03f00000-0x04000000

Hardware Trace Active and Enabled

Boot Mode: 0

Blackfin support (C) 2004-2009 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.2

Blackfin Linux support by   blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 125 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

  External memory: cacheable in instruction cache

Data Cache Enabled for CPU0

  External memory: cacheable (write-back) in data cache

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 14224

Kernel command line: root=/dev/mtdblock0 rw ip=10.100.4.50 earlyprintk=serial,uart0,57600 console=ttyBF0,57600

PID hash table entries: 256 (order: -2, 1024 bytes)

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory available: 47456k/65536k RAM, (7712k init code, 1098k kernel code, 506k data, 1024k dma, 7740k reserved)

Hierarchical RCU implementation.

NR_IRQS:138

Configuring Blackfin Priority Driven Interrupts

console [ttyBF0] enabled, bootconsole disabled

console [ttyBF0] enabled, bootconsole disabled

Calibrating delay loop... 995.32 BogoMIPS (lpj=1990656)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (16 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 48 KB (35 KB free)

NET: Registered protocol family 16

Blackfin DMA Controller

stamp_init(): registering device resources

bio: create slab <bio-0> at 0

Switching to clocksource bfin_cs_cycles

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

UDP hash table entries: 256 (order: 0, 4096 bytes)

UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)

NET: Registered protocol family 1

msgmni has been set to 92

io scheduler noop registered

io scheduler cfq registered (default)

bfin-uart: Blackfin serial driver

bfin-uart.0: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART

brd: module loaded

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

bfin_mii_bus: probed

bfin_mac: attached PHY driver [SMSC LAN83C185] (mii_bus:phy_addr=0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=24)@sclk=125MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

TCP cubic registered

NET: Registered protocol family 17

IP-Config: Guessing netmask 255.0.0.0ck to 2006-04-02 19:40:42 UTC (1144006842)

IP-Config: Complete:

     device=eth0, addr=10.100.4.50, mask=255.0.0.0, gw=255.255.255.255,

     host=10.100.4.50, domain=, nis-domain=(none),

     bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath=

Freeing unused kernel memory: 7712k freed

dma_alloc_init: dma_page @ 0x0298b000 - 256 pages at 0x03f00000

                           _____________________________________

        a8888b.           / Welcome to the uClinux distribution \

       d888888b.         /       _     _                         \

       8P"YP"Y88        /       | |   |_|            __  __ (TM)  |

       8|o||o|88  _____/        | |    _ ____  _   _ \ \/ /       |

       8'    .88       \        | |   | |  _ \| | | | \  /        |

       8`._.' Y8.       \       | |__ | | | | | |_| | /  \        |

      d/      `8b.       \      \____||_|_| |_|\____|/_/\_\       |

     dP   .    Y8b.       \   For embedded processors including   |

    d8:'  "  `::88b        \    the Analog Devices Blackfin      /

   d8"         'Y88b        \___________________________________/

  :8P    '      :888

   8a.   :     _a88P         For further information, check out:

._/"Yaa_:   .| 88P|            -   blackfin.uclinux.org/

\    YP"    `| 8P  `.          -   docs.blackfin.uclinux.org/

/     \.___.d|    .'           -   www.uclinux.org/

`--..__)8888P`._.'  jgs/a:f    -   www.analog.com/blackfin

 

Have a lot of fun...

 

 

BusyBox v1.15.3 (2010-03-17 18:49:49 CST) hush - the humble shell

 

root:/>

root:/> PHY: 0:01 - Link is Up - 100/Full

 

root:/> ls

bin   etc   init  mnt   root  sys   usr

dev   home  lib   proc  sbin  tmp   var

root:/>

root:/>

root:/>

root:/> sqlite3 wishlist.db < /usr/wishlist.sql

root:/> sqlite3 wishlist.db \".dump\"

Error: near "".dump"": syntax error

root:/> sqlite3 wishlist.db .dump

PRAGMA foreign_keys=OFF;

BEGIN TRANSACTION;

CREATE TABLE item (

  id integer primary key not null,

  user_id integer not null,

  externalkey varchar(40),

  description text

);

CREATE TABLE user (

  id integer primary key not null,

  name varchar(40) not null,

  password char(32) not null,

  email varchar(60) not null

);

INSERT INTO "user" VALUES(0,'foo','123','foo@test');

CREATE INDEX item_user on item (user_id);

COMMIT;

root:/>

root:/> sqlite_test

usage: sqlite_test name [name [name [...]]]

root:/> sqlite_test foo

                               +----------------+

                                W I S H  L I S T

                               +----------------+

                               * foo <foo@test> *

 

root:/>

root:/>

root:/>  sqlite3 db

SQLite version 3.6.21

Enter ".help" for instructions

Enter SQL statements terminated with a ";"

sqlite>

sqlite> .tables

sqlite> .exit

root:/>

root:/>

QuoteReplyEditDelete

 

 

2010-03-22 00:57:43     Re: sqlite3 err , database is locked under 2009R1.1-RC4

w w (CHINA)

Message: 87535   

 

thank you sir,

 

your uClinux is bf537-2.6.33.1-ADI-2010R1, where do you get it ? from svn ? I will test it.

 

my uClinux is 2009R1.1-RC4.

 

And what's your file system? ext2?

 

My nor flash file system is jffs2, and my nand flash file system is yaffs.

 

Thank you !

QuoteReplyEditDelete

 

 

2010-03-22 03:40:53     Re: sqlite3 err , database is locked under 2009R1.1-RC4

Mingquan Pan (CHINA)

Message: 87555   

 

You can get our trunk head source from svn.

 

We use ramfs as default file system, jffs for nor flash, ubifs for nand flash.

QuoteReplyEditDelete

 

 

2010-08-12 04:18:11     Re: sqlite3 err , database is locked under 2009R1.1-RC4

Strelkov Nick (RUSSIAN FEDERATION)

Message: 92366   

 

   This problem is caused by unsetting of CONFIG_FILE_LOCKING in kernel by default in uClinux distro.

 

SQLite uses fcntl for database locking. Therefore the CONFIG_FILE_LOCKING must be set to CONFIG_FILE_LOCKING=y (File systems -> [*] Enable POSIX file locking API).

 

QuoteReplyEditDelete

Attachments

    Outcomes